/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package function;

import engine.ani.Player;
import engine.goods.Goods;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import mainpackage.Constant;
import mainpackage.GameBean;
import mainpackage.InputInterFace;
import mainpackage.MainCanvas;
import mainpackage.MainGame;
import mainpackage.MainLogic;
import mainpackage.MainView;
import mainpackage.ResManager;
import mainpackage.Tools;
import ui.UiInterFace;

/**
 *
 * @author Administrator
 */
public class Property {

    private Image[] imgArray = null;
    private String[] sArray = null;
    private int[] iArray = null;
    public int iPositionY = 0;
    private boolean bUiKeyPressLock = false;
    private Player animation;//人物
    public byte bySelectIndex;
    public byte bySubSelectIndex;
    private int startX = 0;
    private int startY = 0;
    private int w = 0;
    private int h = 0;
    private int selectColor = 0x00CCFF;
    private int blackColor = 0x000000;
    private int whiteColor = 0xFFFFFF;
    private int tempColor = 0xffffff;
    private int temp;//用于记录打开加点界面时初始可用点数
    public int[] addData;
    private int[] tempData;
    public String[] sData;
    private int selectNum;
    private short shCurrentPage, shTotalPage;
    private int nums;
    private static final int everyPageNum = 10;
    private String[] bufferName, bufferInfo, bufferTime;
    private long[] bufferId;
    private byte[] isChange;
    public int[] buffTime;
    private long[] buffStartTime;
    private long onLineTime, onLineStartTime;
    private String str_onLineTime;
    private long endTime;
    public byte byState;
    private int popHeight, popWidth;
    private byte byPopUpState;
    public String[] sPlayerNick;
    public byte[] byNicks;
    private boolean bGetPlayerNick;
    public int[] iData;

    public void setPlayerNick(byte[] byNicks) {
        this.bGetPlayerNick = true;
        if (byNicks == null) {
            MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "您还没有获得任何的称号!");
            return;
        }
        this.byNicks = byNicks;
        sPlayerNick = new String[this.byNicks.length];
        for (byte i = 0; i < byNicks.length; i++) {
            sPlayerNick[i] = Tools.nickIDToName(byNicks[i]);
        }
        this.byState = 1;
        this.bySubSelectIndex = 1;
        h = (Constant.FONT_SMALL_HEIGHT + 10) * this.sPlayerNick.length + 10;
        h = h > 80 ? h : 80;
        //#if NOKIA_S60V5
         this.iPositionY = Constant.UI_START_Y + (Constant.END_LINE - h >> 1) + (h - this.sPlayerNick.length * (Constant.FONT_SMALL_HEIGHT + 10) + 10 >> 1) + this.bySubSelectIndex * (Constant.FONT_SMALL_HEIGHT + 10) - 8;
        //#else
//#        this.iPositionY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - h >> 1) + (h - this.sPlayerNick.length * (Constant.FONT_SMALL_HEIGHT + 10) + 10 >> 1) + this.bySubSelectIndex * (Constant.FONT_SMALL_HEIGHT + 10) - 8;
        //#endif
    }

    public void setPlayerCurrentNick(byte stateCode) {
        if (stateCode == 1) {
            this.sData[11] = this.sPlayerNick[this.bySubSelectIndex - 1];
            MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "称号设置成功!");
        } else {
            MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "称号设置失败");
        }
    }

    public void initPlayerInfo() {
//        sPlayerNick = new String[]{"杀戮之神", "越级调整", "顾客大砍刀"};
//        bGetPlayerNick = true;
        sPlayerNick = null;
        bGetPlayerNick = false;
        bUiKeyPressLock = false;
        sArray = new String[]{"人物属性", "角色信息", "属性加点", "气血:", "精气:", "修为:", "经验:",// 0 - 6
            "PK值:", "帮贡:", "帮派代号:", "PK状态:", "称号:", "/"// 7 - 12
        };
        //#if NOKIA_S60V5
         imgArray = new Image[8];
         imgArray[0] = ResManager.createImage(90000017);//背景图片
         imgArray[1] = ResManager.createImage(90000043);//确定、返回图片
         imgArray[2] = ResManager.createImage(90000041);//箭头图片
         imgArray[3] = Tools.makeBlueMask();//蓝色光片
         imgArray[4] = ResManager.createImage(90000084);//方向键
         imgArray[5] = ResManager.createImage(90000085);//确定键
         imgArray[6] = ResManager.createImage(90000086);//底部蓝条
         imgArray[7] = Tools.makeTransparent(ResManager.createImage(90000051), 255);
         iPositionY = Constant.UI_START_Y + 41;
        //#else
//#        imgArray = new Image[5];
        //#if NOKIA_S40V3 || MOTO || K790
        //#elif NORMAL_240_400
//# //            imgArray[0] = ResManager.createImage(90000017);
//# //            imgArray[0] = Tools.ZoomImage(imgArray[0], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
        //#else
//#        //背景图片
//#        //背景图片
//#        imgArray[0] = ResManager.createImage(90000017);//背景图片
        //#endif
        //#if NOKIA_E72
//#         this.imgArray[1] = ResManager.createImage(90000060);
        //#else
//#        imgArray[1] = ResManager.createImage(90000043);//确定、返回图片
        //#endif
//#        imgArray[2] = ResManager.createImage(90000041);//箭头图片
//#        imgArray[3] = Tools.makeBlueMask();//蓝色光片
//#        imgArray[4] = Tools.makeTransparent(ResManager.createImage(90000051), 255);
//#        iPositionY = Constant.UI_START_Y + 21;
        //#endif
        byState = 0;
        bySelectIndex = 1;
        bySubSelectIndex = 1;
        //测试
//        sData = new String[]{"名字长度测试", "43级武师", "200/300", "300/300", "1000", "5000/6000", "200",// 0 - 6
//            "100", "天", "开启中", "关"// 7 - 10
//        };
//        animation = new Player((byte) 1, (byte) 1);
//        animation.changeAction(Constant.PLAYER_STATE_FIGHT_READY, Constant.PLAYER_DIRECTION_DOWN, true, true);
    }

    public void getPlayerInfo(String name, short lev, byte duty, byte sex, int[] data, String tongNo, byte pk, byte byNick) {
        animation = new Player(duty, sex, MainLogic.getInstance().gamePlayer.iPlayerAniId);
        animation.changeAction(Constant.PLAYER_STATE_FIGHT_READY, Constant.PLAYER_DIRECTION_DOWN, true, true);
        sData = new String[12];
        sData[0] = name;//姓名
        sData[1] = lev + Tools.getJobName(duty);//15级武师
        sData[2] = data[0] + "/" + data[1];// hp/hpMax
        sData[3] = data[2] + "/" + data[3];// mp/mpMax
        sData[4] = "" + data[4];// 修为
        sData[5] = data[5] + "/" + data[6];// exp/expNext
        sData[6] = "" + data[7];// pk值
        sData[7] = "" + data[8];// 帮派贡献
        sData[8] = tongNo;// 帮派代号
        if (pk == 0) {
            sData[9] = "关闭中";
            sData[10] = "开";
        } else {
            sData[9] = "开启中";
            sData[10] = "关";
        }
        if (byNick < 1 && byNick > 14) {
            sData[11] = "";
        } else {
            sData[11] = Tools.nickIDToName(byNick);
        }
    }

    public void drawPlayerInfo(Graphics g) {
        //绘制背景
        startX = Constant.UI_START_X + 0;
        startY = Constant.UI_START_Y + 0;
        //#if NOKIA_S60V5
         Tools.drawS60V5Frame(g, imgArray[0], imgArray[4], imgArray[5], imgArray[6], imgArray[1], sArray[0]);
        //#elif NOKIA_E72
//#         Tools.drawE72Frame(g, this.imgArray[0], this.imgArray[1], this.sArray[0]);
        //#else
//#        Tools.drawFrame(g, startX, startY, imgArray[0], null, imgArray[3],
//#                imgArray[1], 0, 0, 24, imgArray[1].getHeight(), imgArray[1], 49, 0, 23, imgArray[1].getHeight(),
//#                sArray[0], whiteColor);
        //#endif
        //绘制选项
        w = Constant.DRAW_WIDTH >> 1;
        startX = Constant.UI_START_X + (w - Constant.FONT_SMALL.stringWidth(sArray[1]) >> 1);
        //#if NOKIA_S60V5
         h = 41;
         startY = Constant.UI_START_Y + 41 + (h - Constant.FONT_SMALL_HEIGHT >> 1);
        //#else
//#        h = Constant.FONT_SMALL_HEIGHT;
//#        startY = Constant.UI_START_Y + 21 + (h - Constant.FONT_SMALL_HEIGHT >> 1);
        //#endif
        Tools.drawShadowString(g, (byte) 1, sArray[1], startX, startY, selectColor, blackColor);
        startX += w;
        Tools.drawShadowString(g, (byte) 1, sArray[2], startX, startY, whiteColor, blackColor);
        //绘制选项箭头
        startX = Constant.UI_START_X + (w - Constant.FONT_SMALL.stringWidth(sArray[1]) >> 1) - 3 - 5;
        startY = startY + (Constant.FONT_SMALL_HEIGHT - 7 >> 1);
        Tools.drawArrow(g, imgArray[2], (byte) 1, startX, startY);
        startX = Constant.UI_START_X + (w - Constant.FONT_SMALL.stringWidth(sArray[1]) >> 1)
                + Constant.FONT_SMALL.stringWidth(sArray[1]) + 3;
        Tools.drawArrow(g, imgArray[2], (byte) 2, startX, startY);
        //绘制固定选择条
        startX = Constant.UI_START_X + 0;
        //#if NOKIA_S60V5
         startY = Constant.UI_START_Y + 41 + h;
        //#else
//#        startY = Constant.UI_START_Y + 21 + h;
        //#endif
        w = Constant.DRAW_WIDTH;
        Tools.drawSelectMask(g, (byte) 1, imgArray[3], startX, startY, w);
        //人物
        startX = Constant.UI_START_X + 50;
        //#if NOKIA_S60V5
         startY = Constant.UI_START_Y + 200;
        //#else
//#        startY = Constant.UI_START_Y + 110;
        //#endif
        MainLogic.getInstance().gamePlayer.showOnlyAni(g, startX, startY, Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN);
        //绘制玩家姓名
        startX = Constant.UI_START_X + 90;
        //#if NOKIA_S60V5
         startY = Constant.UI_START_Y + 41 + h;
         h = (Constant.END_LINE - (41 << 1)) / 10;
         startY += (h - Constant.FONT_SMALL_HEIGHT >> 1);
        //#else
//#        startY = Constant.UI_START_Y + 21 + h;
//#        h = Constant.FONT_SMALL_HEIGHT;
//#        startY += (h - Constant.FONT_SMALL_HEIGHT >> 1);
        //#endif
        int nameColor = 0xffffff;
        if (Integer.parseInt(sData[6]) == 0) {
            nameColor = 0xffffff;
        } else if (Integer.parseInt(sData[6]) < 30) {
            nameColor = 0xffcc00;
        } else {
            nameColor = 0xff3333;
        }
        Tools.drawShadowString(g, (byte) 1, sData[0], startX, startY, nameColor, blackColor);//名字
        startY += h;
        Tools.drawShadowString(g, (byte) 1, sData[1], startX, startY, whiteColor, blackColor);//等级职业
        startY += h;
        //气血、精气、修为
        for (int i = 0; i < 3; i++) {
            Tools.drawShadowString(g, (byte) 1, sArray[3 + i] + sData[2 + i], startX, startY, whiteColor, blackColor);
            startY += h;
        }
        //经验
        //#if NOKIA_E72
//#         startX = Constant.UI_START_X + 90;
        //#else
        startX = Constant.UI_START_X + 5;
        //#endif

        Tools.drawShadowString(g, (byte) 1, sArray[6], startX, startY, whiteColor, blackColor);
        startX += Constant.FONT_SMALL.stringWidth(sArray[6]);
        w = 125;
        h = 5;
        g.setColor(0x000000);
        g.drawRect(startX, startY + (Constant.FONT_SMALL_HEIGHT - h >> 1), w, h);
        g.setColor(0x40b9cc);
        g.fillRect(startX + 1, startY + (Constant.FONT_SMALL_HEIGHT - h >> 1) + 1, w - 1, h - 1);
        g.setColor(0xFF0000);
        int exp = Integer.parseInt(sData[5].substring(0, sData[5].indexOf(sArray[12])));
        int expMax = Integer.parseInt(sData[5].substring(sData[5].indexOf(sArray[12]) + 1, sData[5].length()));
        if (expMax <= 0) {
//            w = exp * w / expMax;
        } else {
            w = exp * w / expMax;
        }
        g.fillRect(startX + 1, startY + (Constant.FONT_SMALL_HEIGHT - h >> 1) + 1, w, h - 1);
        Tools.drawShadowString(g, (byte) 1, sData[5], startX + (125 - Constant.FONT_SMALL.stringWidth(sData[5]) >> 1),
                startY, whiteColor, blackColor);
        //PK值、帮派代号、帮派贡献
        //#if NOKIA_E72
//#         startX = Constant.UI_START_X + 90;
        //#else
        startX = Constant.UI_START_X + 5;
        //#endif
        //#if NOKIA_S60V5
         h = (Constant.END_LINE - (41 << 1)) / 10;
        //#else
//#        h = Constant.FONT_SMALL_HEIGHT;
        //#endif
        startY += h;
        for (int i = 0; i < 5; i++) {
            if (i != 3) {
                Tools.drawShadowString(g, (byte) 1, sArray[7 + i] + sData[i == 4 ? 7 + i : 6 + i], startX, startY, i == 4 && (this.byState == 1 || (this.byState != 1 && this.bySubSelectIndex == 3)) ? selectColor : whiteColor, blackColor);
                startY += h;
            } else {
                //PK状态
                Tools.drawShadowString(g, (byte) 1, sArray[10], startX, startY, whiteColor, blackColor);//PK状态
                startX = startX + Constant.FONT_SMALL.stringWidth(sArray[10]) + 4;
                Tools.drawShadowString(g, (byte) 1, sData[9], startX, startY, whiteColor, blackColor);//开启中或者关闭中
                startX = startX + 4 + Constant.FONT_SMALL.stringWidth(sData[9]) + 5 + 3;
                Tools.drawShadowString(g, (byte) 1, sData[10], startX, startY, this.byState == 0 && bySubSelectIndex == 2 ? selectColor : whiteColor, blackColor);//开、关控制
                startX = startX - 5 - 3;
                int tempStartY = startY;
                startY = startY + (Constant.FONT_SMALL_HEIGHT - 7 >> 1);
                Tools.drawArrow(g, imgArray[2], bySubSelectIndex == 2 ? (byte) 1 : (byte) 5, startX, startY);
                startX = startX + 5 + 3 + Constant.FONT_SMALL.stringWidth(sData[10]) + 3;
                Tools.drawArrow(g, imgArray[2], bySubSelectIndex == 2 ? (byte) 2 : (byte) 6, startX, startY);
                startY = tempStartY + h;
                //#if NOKIA_E72
//#                 startX = Constant.UI_START_X + 90;
                //#else
                startX = Constant.UI_START_X + 5;
                //#endif
            }
        }
        if (byState != 1) {
            //绘制选择条
            startX = Constant.UI_START_X + 0;
            w = Constant.DRAW_WIDTH;
            Tools.drawSelectMask(g, bySubSelectIndex == 1 ? (byte) 2 : (byte) 1, imgArray[3], startX, iPositionY, w);
        } else {
            w = 232;
            h = this.sPlayerNick.length * (Constant.FONT_SMALL_HEIGHT + 10) + 10;
            h = h > 80 ? h : 80;
            startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - 232 >> 1);
            //#if NOKIA_S60V5
             startY = Constant.UI_START_X + (Constant.END_LINE - h >> 1);
             Tools.drawRoundRect(g, this.imgArray[7], 0x989898, w, h, startX, startY);
            //#else
//#            startY = Constant.UI_START_X + (Constant.DRAW_HEIGHT - h >> 1);
//#            Tools.drawRoundRect(g, this.imgArray[4], 0x989898, w, h, startX, startY);
            //#endif
            startY += (h - (Constant.FONT_SMALL_HEIGHT + 10) * this.sPlayerNick.length + 10 >> 1);
            for (byte i = 0; i < sPlayerNick.length; i++) {
                startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(this.sPlayerNick[i]) >> 1);
                Tools.drawShadowString(g, (byte) 1, this.sPlayerNick[i], startX, startY, i + 1 == this.bySubSelectIndex ? 0x00CCFF : 0xFFFFFF, 0x000000);
                startY += Constant.FONT_SMALL_HEIGHT + 10;
            }
            Tools.drawSelectMask(g, (byte) 1, imgArray[3], Constant.UI_START_X, iPositionY, Constant.DRAW_WIDTH);
        }
    }
    public void checkTouchPlayerInfo(int x, int y) {
		switch(UiInterFace.property.byState) {
		case 0:
			int[][] touchrect = new int[][]{
//					{0,40,180,40},
					{180,40,180,40},
			};
			int touched = MainCanvas.checkTouch(x, y, touchrect);
			if (touched >= 0) {
				MainCanvas.pressDir(2);
			} else {
				MainCanvas.checkSoftKey();
			}
			break;
		case 1:
			break;
		}
				
	}
    public void updatePlayerInfo() {
        if (GameBean.b_WAIT_NET_MSG_BACK) {
            return;
        }
        switch (this.byState) {
            case 0:
                if (!bUiKeyPressLock) {
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                        bUiKeyPressLock = true;
                        bySubSelectIndex = (byte) (bySubSelectIndex == 1 ? 3 : bySubSelectIndex - 1);
                        //#if NOKIA_S60V5
                         startY = bySubSelectIndex == 1 ? Constant.UI_START_Y + 41
                                 : Constant.UI_START_Y + Constant.END_LINE + (bySubSelectIndex - 2) * Constant.FONT_SMALL_HEIGHT;
                        //#else
//#                        startY = bySubSelectIndex == 1 ? Constant.UI_START_Y + 21
//#                                : Constant.UI_START_Y + 21 + Constant.FONT_SMALL_HEIGHT * 10 + (bySubSelectIndex - 1) * Constant.FONT_SMALL_HEIGHT;
                        //#endif
                        iArray = new int[]{2, 1, startY, 2, 55, 5};
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                        bUiKeyPressLock = true;
                        bySubSelectIndex = (byte) (bySubSelectIndex == 3 ? 1 : bySubSelectIndex + 1);
                        //#if NOKIA_S60V5
                         startY = bySubSelectIndex == 1 ? Constant.UI_START_Y + 41
                                 : Constant.UI_START_Y + Constant.END_LINE + (bySubSelectIndex - 2) * Constant.FONT_SMALL_HEIGHT;
                        //#else
//#                        startY = bySubSelectIndex == 1 ? Constant.UI_START_Y + 21
//#                                : Constant.UI_START_Y + 21 + Constant.FONT_SMALL_HEIGHT * 10 + (bySubSelectIndex - 1) * Constant.FONT_SMALL_HEIGHT;
                        //#endif
                        iArray = new int[]{1, 1, startY, 2, 55, 5};
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_LEFT, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_RIGHT, false)) {
                        bUiKeyPressLock = true;
                        if (bySubSelectIndex == 1) {
                            GameBean.b_WAIT_NET_MSG_BACK = true;
                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_OPEN_PROPERTY_POINT, Constant.SOCKET_MSG_TYPE_LOGIC);
                        } else if (bySubSelectIndex == 2) {//设置PK状态
                            GameBean.b_WAIT_NET_MSG_BACK = true;
                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_PK, Constant.SOCKET_MSG_TYPE_LOGIC);
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)) {//确定
                        Tools.openRoamMenu(false, (byte) 1, (byte) 2, 1);
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//返回
                        Tools.openRoamMenu(false, (byte) 1, (byte) 2, 1);
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {
                        switch (bySubSelectIndex) {
                            case 2:
                                GameBean.b_WAIT_NET_MSG_BACK = true;//设置PK状态
                                MainLogic.getInstance().send(Constant.MSG_NET_CMD_PK, Constant.SOCKET_MSG_TYPE_LOGIC);
                                break;
                            case 3:
                                if (!this.bGetPlayerNick) {
                                    GameBean.b_WAIT_NET_MSG_BACK = true;
                                    GameBean.L_PLAYER_ID = MainLogic.getInstance().gamePlayer.lPlayerID;
                                    MainLogic.getInstance().send(Constant.MSG_NET_CMD_CHECK_PLAYER_NICK, Constant.SOCKET_MSG_TYPE_LOGIC);
                                } else {
                                    if (this.sPlayerNick == null) {
                                        MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "您暂时还没有任何的称号");
                                    } else {
                                        setPlayerNick(this.byNicks);
                                    }
                                }
                                break;
                        }
                    }

                } else {
                    iPositionY = Tools.updateLinePos(iArray, iPositionY);
                    if (iArray == null || iArray[1] == 0) {
                        bUiKeyPressLock = false;
                    }
                }
                break;
            case 1:
                if (!bUiKeyPressLock) {
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                        bUiKeyPressLock = true;
                        bySubSelectIndex = (byte) (bySubSelectIndex == 1 ? this.sPlayerNick.length : bySubSelectIndex - 1);
                        h = (Constant.FONT_SMALL_HEIGHT + 10) * this.sPlayerNick.length + 10;
                        h = h > 80 ? h : 80;
                        //#if NOKIA_S60V5
                         startY = Constant.UI_START_Y + (Constant.END_LINE - h >> 1) + (h - this.sPlayerNick.length * (Constant.FONT_SMALL_HEIGHT + 10) + 10 >> 1) + this.bySubSelectIndex * (Constant.FONT_SMALL_HEIGHT + 10) - 8;
                        //#else
//#                        startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - h >> 1) + (h - this.sPlayerNick.length * (Constant.FONT_SMALL_HEIGHT + 10) + 10 >> 1) + this.bySubSelectIndex * (Constant.FONT_SMALL_HEIGHT + 10) - 8;
                        //#endif
                        iArray = new int[]{2, 1, startY, 2, 55, 5};
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                        bUiKeyPressLock = true;
                        bySubSelectIndex = (byte) (bySubSelectIndex == this.sPlayerNick.length ? 1 : bySubSelectIndex + 1);
                        h = (Constant.FONT_SMALL_HEIGHT + 10) * this.sPlayerNick.length + 10;
                        h = h > 80 ? h : 80;
                        //#if NOKIA_S60V5
                         startY = Constant.UI_START_Y + (Constant.END_LINE - h >> 1) + (h - this.sPlayerNick.length * (Constant.FONT_SMALL_HEIGHT + 10) + 10 >> 1) + this.bySubSelectIndex * (Constant.FONT_SMALL_HEIGHT + 10) - 8;
                        //#else
//#                        startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - h >> 1) + (h - this.sPlayerNick.length * (Constant.FONT_SMALL_HEIGHT + 10) + 10 >> 1) + this.bySubSelectIndex * (Constant.FONT_SMALL_HEIGHT + 10) - 8;
                        //#endif
                        iArray = new int[]{1, 1, startY, 2, 55, 5};
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {//确定
                        if (this.sData[11].length() > 0 && this.sData[11].equals(this.sPlayerNick[this.bySubSelectIndex - 1])) {
                            MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "您当前用的就是该称号!");
                        } else {
                            GameBean.b_WAIT_NET_MSG_BACK = true;
                            GameBean.BY_TYPE = this.byNicks[this.bySubSelectIndex - 1];
                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_SET_PLAYER_NICK, Constant.SOCKET_MSG_TYPE_LOGIC);
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//返回
                        this.byState = 0;
                        this.bySubSelectIndex = 3;
                        //#if NOKIA_S60V5
                         this.iPositionY = bySubSelectIndex == 1 ? Constant.UI_START_Y + 41
                                 : Constant.UI_START_Y + Constant.END_LINE + (bySubSelectIndex - 2) * Constant.FONT_SMALL_HEIGHT;
                        //#else
//#                        this.iPositionY = bySubSelectIndex == 1 ? Constant.UI_START_Y + 21
//#                                : Constant.UI_START_Y + 21 + Constant.FONT_SMALL_HEIGHT * 10 + (bySubSelectIndex - 1) * Constant.FONT_SMALL_HEIGHT;
                        //#endif
                    }
                } else {
                    iPositionY = Tools.updateLinePos(iArray, iPositionY);
                    if (iArray == null || iArray[1] == 0) {
                        bUiKeyPressLock = false;
                    }
                }
                break;
        }
    }

    public void clearPlayerInfo() {
        imgArray = null;
        sArray = null;
        animation = null;
        sData = null;
        this.byNicks = null;
        this.sPlayerNick = null;
    }

    public void initPropertyAddPoint() {
        bUiKeyPressLock = false;
        //#if NOKIA_S60V5
         imgArray = new Image[7];
         imgArray[0] = ResManager.createImage(90000017);//背景图片
         imgArray[1] = ResManager.createImage(90000043);//确定、返回图片
         imgArray[2] = ResManager.createImage(90000041);//箭头图片
         imgArray[3] = Tools.makeBlueMask();//蓝色光片
         imgArray[4] = ResManager.createImage(90000084);//方向键
         imgArray[5] = ResManager.createImage(90000085);//确定键
         imgArray[6] = ResManager.createImage(90000086);//底部蓝条
         iPositionY = Constant.UI_START_Y + 41;
        //#else
//#        imgArray = new Image[5];
        //#if NOKIA_S40V3 || MOTO || K790
        //#elif NORMAL_240_400
//# //            imgArray[0] = ResManager.createImage(90000017);
//# //            imgArray[0] = Tools.ZoomImage(imgArray[0], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
        //#else
//#        //背景图片
//#        //背景图片
//#        imgArray[0] = ResManager.createImage(90000017);//背景图片
        //#endif
        //#if NOKIA_E72
//#         this.imgArray[1] = ResManager.createImage(90000060);
        //#else
//#        imgArray[1] = ResManager.createImage(90000043);//确定、返回图片
        //#endif
//#        imgArray[2] = ResManager.createImage(90000041);//箭头图片
//#        imgArray[3] = Tools.makeBlueMask();//蓝色光片
//#        imgArray[4] = Tools.makeTransparent(Constant.SCREEN_WIDTH, 10, 220, 0x252525);//半透明背景图片
//#        iPositionY = Constant.UI_START_Y + 21;
        //#endif
        bySelectIndex = 2;
        bySubSelectIndex = 1;
        addData = new int[5];
        for (int i = 0; i < addData.length; i++) {
            addData[i] = 0;
        }
        sArray = new String[]{"人物属性", "角色信息", "属性加点", "臂力:", "体魄:", "气力:", "敏捷:", "悟性:",// 0 - 7
            "气血上限:", "精气上限:", "攻击:", "防御:", "命中:", "闪避:", "幸运一击:", "血气回复:", "精气回复:",// 8 - 16
            "冰攻:", "冰抗:", "冰防:", "火攻:", "火抗:", "火防:", "毒攻:", "毒抗:", "毒防:", "剩余点数:"// 17 - 26
        };
        //测试
//        sData = new String[24];
//        for (int i = 0; i < sData.length; i++) {
//            sData[i] = "" + 50 + i;
//        }
//        temp = Integer.parseInt(sData[23]);
    }

    public void getPropertyAddPoint(int[] data) {
        sData = new String[24];
        tempData = data;
        // 0 臂力   1 体魄  2 气力  3 敏捷  4 悟性  5 气血上限  6 精气上限
        // 7 攻击   8 防御  9 命中 10 闪避 11 幸运一击 12 血气回复 13 精气回复
        // 14 冰攻  15 冰抗 16 冰防 17 火攻 18 火抗 19 火防 20 毒攻 21 毒抗 22 毒防
        // 23 剩余点数
        for (int i = 0; i < data.length; i++) {
            sData[i] = "" + data[i];
        }
        temp = data[23];
    }

    public void setPointInfo() {
        //攻击      等级*2+臂力*2+气力*2
        sData[7] = "" + (tempData[7] + (addData[0] + addData[2]) * 2);
        //气血上限  等级*80+臂力*10+体魄*20
        sData[5] = "" + (tempData[5] + addData[0] * 10 + addData[1] * 20);
        //防御      等级+体魄+敏捷
        sData[8] = "" + (tempData[8] + addData[1] + addData[3]);
        //血气回复  等级*1.5/10+体魄/10
        sData[12] = "" + (tempData[12] + addData[1] / 10);
        //精气上限  等级*8+气力*4	
        sData[6] = "" + (tempData[6] + addData[2] * 4);
        //精气回复  等级*1.2/10+气力/10	
        sData[13] = "" + (tempData[13] + addData[2] / 10);
        //命中      等级*4+灵敏*4	
        sData[9] = "" + (tempData[9] + addData[3] * 4);
        //闪避      等级*2+灵敏*2
        sData[10] = "" + (tempData[10] + addData[3] * 2);
    }

    public void drawPropertyAddPoint(Graphics g) {
        //绘制背景
        startX = Constant.UI_START_X + 0;
        startY = Constant.UI_START_Y + 0;
        //#if NOKIA_S60V5
         Tools.drawS60V5Frame(g, imgArray[0], imgArray[4], imgArray[5], imgArray[6], imgArray[1], sArray[0]);
        //#elif NOKIA_E72
//#         Tools.drawE72Frame(g, this.imgArray[0], this.imgArray[1], this.sArray[1]);
        //#else
//#        Tools.drawFrame(g, startX, startY, imgArray[0], null, imgArray[3],
//#                imgArray[1], 0, 0, 24, imgArray[1].getHeight(), imgArray[1], 49, 0, 23, imgArray[1].getHeight(),
//#                sArray[1], whiteColor);
        //#endif
        //绘制选项
        w = Constant.DRAW_WIDTH >> 1;
        startX = Constant.UI_START_X + (w - Constant.FONT_SMALL.stringWidth(sArray[1]) >> 1);
        //#if NOKIA_S60V5
         h = 41;
         startY = Constant.UI_START_Y + 41 + (h - Constant.FONT_SMALL_HEIGHT >> 1);
        //#else
//#        h = Constant.FONT_SMALL_HEIGHT;
//#        startY = Constant.UI_START_Y + 21 + (h - Constant.FONT_SMALL_HEIGHT >> 1);
        //#endif
        Tools.drawShadowString(g, (byte) 1, sArray[1], startX, startY, whiteColor, blackColor);
        startX += w;
        Tools.drawShadowString(g, (byte) 1, sArray[2], startX, startY, selectColor, blackColor);
        //绘制选项箭头
        startX = Constant.UI_START_X + w + (w - Constant.FONT_SMALL.stringWidth(sArray[1]) >> 1) - 3 - 5;
        startY = startY + (Constant.FONT_SMALL_HEIGHT - 7 >> 1);
        Tools.drawArrow(g, imgArray[2], (byte) 1, startX, startY);
        startX = Constant.UI_START_X + w + (w - Constant.FONT_SMALL.stringWidth(sArray[1]) >> 1)
                + Constant.FONT_SMALL.stringWidth(sArray[1]) + 3;
        Tools.drawArrow(g, imgArray[2], (byte) 2, startX, startY);
        //绘制固定选择条
        startX = Constant.UI_START_X + 0;
        w = Constant.DRAW_WIDTH;
        //#if NOKIA_S60V5
         startY = Constant.UI_START_Y + 41 + h;
        //#else
//#        startY = Constant.UI_START_Y + 21 + h;
        //#endif
        Tools.drawSelectMask(g, (byte) 1, imgArray[3], startX, startY, w);
        //臂力 - 精气上限
        startX = Constant.UI_START_X + 5;
        w = Constant.DRAW_WIDTH >> 1;
        //#if NOKIA_S60V5
         startY = Constant.UI_START_Y + 41 + h;
         h = (Constant.END_LINE - (41 << 1)) / 10;
         
         boolean need = !MainCanvas.existUI(Constant.GAME_UI_PROPERTY_ADD_POINT);
         int[][] touchrect = null;
         if (need) {
        	 touchrect = new int[7+1][];
        	 touchrect[0] = new int[]{0,40,180,40};
         }
        	 
         startY += (h - Constant.FONT_SMALL_HEIGHT >> 1);
        //#else
//#        startY = Constant.UI_START_Y + 21 + h;
//#        h = Constant.FONT_SMALL_HEIGHT;
//#        startY += (h - Constant.FONT_SMALL_HEIGHT >> 1);
        //#endif
        for (int i = 0; i < 7; i++) {
            Tools.drawShadowString(g, (byte) 1, sArray[i + 3], i < 5 ? startX + 3 : startX, startY, whiteColor, blackColor);
            if (i > 4) {
                if (Integer.parseInt(sData[i]) > tempData[i]) {
                    tempColor = selectColor;
                } else {
                    tempColor = whiteColor;
                }
            } else {
                tempColor = whiteColor;
            }
            Tools.drawShadowString(g, (byte) 1, sData[i], i < 5 ? startX + 3 + Constant.FONT_SMALL.stringWidth(sArray[i + 3])
                    : startX + Constant.FONT_SMALL.stringWidth(sArray[i + 3]), startY, tempColor, blackColor);
            Tools.drawShadowString(g, (byte) 1, sArray[i + 10], startX + w, startY, whiteColor, blackColor);
            if (Integer.parseInt(sData[i + 7]) > tempData[i + 7]) {
                tempColor = selectColor;
            } else {
                tempColor = whiteColor;
            }
            Tools.drawShadowString(g, (byte) 1, sData[i + 7], startX + w + Constant.FONT_SMALL.stringWidth(sArray[i + 10]),
                    startY, tempColor, blackColor);
            if (need && i<5) {
            	touchrect[i+1] = new int[]{0,startY - (Constant.FONT_SMALL_HEIGHT >> 1),360,h};
            }
            startY += h;
        }
        if(need) {
        	MainCanvas.putHash(Constant.GAME_UI_PROPERTY_ADD_POINT, touchrect);
        }
        //冰攻 - 毒防
        //#if NOKIA_E72
//#         w = Constant.DRAW_WIDTH / 5;
//#         Tools.drawShadowString(g, (byte) 1, sArray[0 + 17] + sData[0 + 14], startX, startY, whiteColor, blackColor);
//#         Tools.drawShadowString(g, (byte) 1, sArray[1 + 17] + sData[1 + 14], startX + w, startY, whiteColor, blackColor);
//#         Tools.drawShadowString(g, (byte) 1, sArray[2 + 17] + sData[2 + 14], startX + w * 2, startY, whiteColor, blackColor);
//#         Tools.drawShadowString(g, (byte) 1, sArray[0 + 20] + sData[0 + 17], startX + w * 3, startY, whiteColor, blackColor);
//#         Tools.drawShadowString(g, (byte) 1, sArray[1 + 20] + sData[1 + 17], startX + w * 4, startY, whiteColor, blackColor);
//#         Tools.drawShadowString(g, (byte) 1, sArray[2 + 20] + sData[2 + 17], startX, startY + h, whiteColor, blackColor);
//#         Tools.drawShadowString(g, (byte) 1, sArray[0 + 23] + sData[0 + 20], startX + w, startY + h, whiteColor, blackColor);
//#         Tools.drawShadowString(g, (byte) 1, sArray[1 + 23] + sData[1 + 20], startX + w * 2, startY + h, whiteColor, blackColor);
//#         Tools.drawShadowString(g, (byte) 1, sArray[2 + 23] + sData[2 + 20], startX + w * 3, startY + h, whiteColor, blackColor);
//# //        for (int i = 0; i < 3; i++) {
//# //            Tools.drawShadowString(g, (byte) 1, sArray[i + 17] + sData[i + 14], startX, startY, whiteColor, blackColor);
//# //            Tools.drawShadowString(g, (byte) 1, sArray[i + 20] + sData[i + 17], startX + w, startY, whiteColor, blackColor);
//# //            Tools.drawShadowString(g, (byte) 1, sArray[i + 23] + sData[i + 20], startX + w * 2, startY, whiteColor, blackColor);
//# //            startY += h;
//# //        }
        //#else
        w = Constant.DRAW_WIDTH / 3;

        for (int i = 0; i < 3; i++) {
            Tools.drawShadowString(g, (byte) 1, sArray[i + 17] + sData[i + 14], startX, startY, whiteColor, blackColor);
            Tools.drawShadowString(g, (byte) 1, sArray[i + 20] + sData[i + 17], startX + w, startY, whiteColor, blackColor);
            Tools.drawShadowString(g, (byte) 1, sArray[i + 23] + sData[i + 20], startX + w * 2, startY, whiteColor, blackColor);
            startY += h;
        }
        //#endif

        //可用点数
        startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sArray[26] + sData[23]) >> 1);
        //#if NOKIA_S60V5
         h = 58;
        //#else
//#        h = 25;
        //#endif
        startY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - h + (h - Constant.FONT_SMALL_HEIGHT >> 1);
        Tools.drawShadowString(g, (byte) 1, sArray[26] + sData[23], startX, startY, selectColor, blackColor);
        //选择条
        startX = Constant.UI_START_X + 0;
        w = Constant.DRAW_WIDTH;
        if (bySubSelectIndex == 1) {
            Tools.drawSelectMask(g, (byte) 2, imgArray[3], startX, iPositionY, w);
        } else {
            //#if NOKIA_S60V5
             h = (Constant.END_LINE - (41 << 1)) / 10;
            //#else
//#            h = Constant.FONT_SMALL_HEIGHT;
            //#endif
            Tools.drawGapSlectMask(g, imgArray[3], null, false, h, startX, iPositionY, w);
            //加点箭头
            if (addData[bySubSelectIndex - 2] > 0) {
                startX = Constant.UI_START_X + 0;
                //#if NOKIA_S60V5
                 startY = Constant.UI_START_Y + (41 << 1) + (bySubSelectIndex - 2) * h + (h - 7 >> 1);
                //#else
//#                startY = Constant.UI_START_Y + 21 + Constant.FONT_SMALL_HEIGHT + (bySubSelectIndex - 2) * h + (h - 7 >> 1);
                //#endif
                Tools.drawArrow(g, imgArray[2], (byte) 1, startX, startY);
            }
            if (tempData[23] > 0) {
                startX = Constant.UI_START_X + 5 + Constant.FONT_SMALL.stringWidth(sArray[bySubSelectIndex + 1] + sData[bySubSelectIndex - 2]) + 3;
                //#if NOKIA_S60V5
                 startY = Constant.UI_START_Y + (41 << 1) + (bySubSelectIndex - 2) * h + (h - 7 >> 1);
                //#else
//#                startY = Constant.UI_START_Y + 21 + Constant.FONT_SMALL_HEIGHT + (bySubSelectIndex - 2) * h + (h - 7 >> 1);
                //#endif
                Tools.drawArrow(g, imgArray[2], (byte) 2, startX, startY);
            }
        }
        
        startY += h + 10;
        Tools.drawShadowString(g, (byte) 1, "选中后，点击屏幕右边增加，左边减少。", startX, startY, selectColor, blackColor);
    }
    

	public void checkTouchADDPoint(int x, int y) {
		Integer key = new Integer(MainLogic.getInstance().byGameState); 
		int[][] touchrect = (int[][]) MainCanvas.s_uiTouch.get(key);
		if (touchrect == null) {
			return;
		}
		int touched = MainCanvas.checkTouch(x, y, touchrect);
		if (touched >= 0) {
			if (touched == 0) {
				UiInterFace.property.bySubSelectIndex = 1;
				MainCanvas.pressDir(2);
			} else {
				touched += 1;
				if (touched == UiInterFace.property.bySubSelectIndex) {
					if (x > 180) {//add
						MainCanvas.pressDir(3);
					} else {
						MainCanvas.pressDir(2);
					}
				} else {
					if (touched > UiInterFace.property.bySubSelectIndex) {//向下
						UiInterFace.property.bySubSelectIndex = (byte) (touched -1);
						MainCanvas.pressDir(1);
					} else {
						UiInterFace.property.bySubSelectIndex = (byte) (touched +1);
						MainCanvas.pressDir(0);
					}
					
				}
			}
		} else {
			MainCanvas.checkSoftKey();
		}		
	}

    public void updatePropertyAddPoint() {
        if (GameBean.b_WAIT_NET_MSG_BACK) {
            return;
        }
        if (!bUiKeyPressLock) {
            if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                bUiKeyPressLock = true;
                if (bySubSelectIndex == 2) {
                    bySubSelectIndex = 1;
                    //#if NOKIA_S60V5
                     startY = Constant.UI_START_Y + 41;
                    //#else
//#                    startY = Constant.UI_START_Y + 21;
                    //#endif
                    iArray = new int[]{2, 1, startY, 2, 55, 5};
                } else {
                    bySubSelectIndex = (byte) (bySubSelectIndex == 1 ? 6 : (bySubSelectIndex - 1));
                    //#if NOKIA_S60V5
                     h = (Constant.END_LINE - (41 << 1)) / 10;
                     startY = Constant.UI_START_Y + (41 << 1) + (bySubSelectIndex - 2) * h;
                    //#else
//#                    h = Constant.FONT_SMALL_HEIGHT;
//#                    startY = Constant.UI_START_Y + 21 + Constant.FONT_SMALL_HEIGHT + (bySubSelectIndex - 2) * h;
                    //#endif
                    iArray = new int[]{2, 1, startY, 2, 55, 5};
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                bUiKeyPressLock = true;
                if (bySubSelectIndex == 6) {
                    bySubSelectIndex = 1;
                    //#if NOKIA_S60V5
                     startY = Constant.UI_START_Y + 41;
                    //#else
//#                    startY = Constant.UI_START_Y + 21;
                    //#endif
                    iArray = new int[]{1, 1, startY, 2, 55, 5};
                } else {
                    bySubSelectIndex++;
                    //#if NOKIA_S60V5
                     h = (Constant.END_LINE - (41 << 1)) / 10;
                     startY = Constant.UI_START_Y + (41 << 1) + (bySubSelectIndex - 2) * h;
                    //#else
//#                    h = Constant.FONT_SMALL_HEIGHT;
//#                    startY = Constant.UI_START_Y + 21 + Constant.FONT_SMALL_HEIGHT + (bySubSelectIndex - 2) * h;
                    //#endif
                    iArray = new int[]{1, 1, startY, 2, 55, 5};
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_LEFT, false)) {
                bUiKeyPressLock = true;
                if (bySubSelectIndex > 1) {
                    switch (bySubSelectIndex) {
                        case 2:
                            if (addData[0] > 0) {
                                tempData[0]--;
                                tempData[23]++;
                                addData[0]--;
                                sData[0] = "" + tempData[0];
                                sData[23] = "" + tempData[23];
                            }
                            break;
                        case 3:
                            if (addData[1] > 0) {
                                tempData[1]--;
                                tempData[23]++;
                                addData[1]--;
                                sData[1] = "" + tempData[1];
                                sData[23] = "" + tempData[23];
                            }
                            break;
                        case 4:
                            if (addData[2] > 0) {
                                tempData[2]--;
                                tempData[23]++;
                                addData[2]--;
                                sData[2] = "" + tempData[2];
                                sData[23] = "" + tempData[23];
                            }
                            break;
                        case 5:
                            if (addData[3] > 0) {
                                tempData[3]--;
                                tempData[23]++;
                                addData[3]--;
                                sData[3] = "" + tempData[3];
                                sData[23] = "" + tempData[23];
                            }
                            break;
                        case 6:
                            if (addData[4] > 0) {
                                tempData[4]--;
                                tempData[23]++;
                                addData[4]--;
                                sData[4] = "" + tempData[4];
                                sData[23] = "" + tempData[23];
                            }
                            break;
                    }
                    setPointInfo();
                } else {
                    GameBean.b_WAIT_NET_MSG_BACK = true;
                    MainLogic.getInstance().send(Constant.MSG_NET_CMD_CHECK_PROPERTY, Constant.SOCKET_MSG_TYPE_LOGIC);
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_RIGHT, false)) {
                bUiKeyPressLock = true;
                if (bySubSelectIndex > 1) {
                    if (tempData[23] > 0) {
                        switch (bySubSelectIndex) {
                            case 2:
                                tempData[0]++;
                                tempData[23]--;
                                addData[0]++;
                                sData[0] = "" + tempData[0];
                                sData[23] = "" + tempData[23];
                                break;
                            case 3:
                                tempData[1]++;
                                tempData[23]--;
                                addData[1]++;
                                sData[1] = "" + tempData[1];
                                sData[23] = "" + tempData[23];
                                break;
                            case 4:
                                tempData[2]++;
                                tempData[23]--;
                                addData[2]++;
                                sData[2] = "" + tempData[2];
                                sData[23] = "" + tempData[23];
                                break;
                            case 5:
                                tempData[3]++;
                                tempData[23]--;
                                addData[3]++;
                                sData[3] = "" + tempData[3];
                                sData[23] = "" + tempData[23];
                                break;
                            case 6:
                                tempData[4]++;
                                tempData[23]--;
                                addData[4]++;
                                sData[4] = "" + tempData[4];
                                sData[23] = "" + tempData[23];
                                break;
                        }
                        setPointInfo();
                    }
                } else {
                    GameBean.b_WAIT_NET_MSG_BACK = true;
                    MainLogic.getInstance().send(Constant.MSG_NET_CMD_CHECK_PROPERTY, Constant.SOCKET_MSG_TYPE_LOGIC);
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                    || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                    || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {
                //确定加点
                if (tempData[23] == temp) {
                    return;
                } else {
                    MainLogic.getInstance().send(Constant.MSG_NET_CMD_ADD_ATTR_POINT, Constant.SOCKET_MSG_TYPE_LOGIC);
                    GameBean.b_WAIT_NET_MSG_BACK = true;
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                //返回上一级菜单
                Tools.openRoamMenu(false, (byte) 1, (byte) 2, 1);
            }
        } else {
            iPositionY = Tools.updateLinePos(iArray, iPositionY);
            if (iArray == null || iArray[1] == 0) {
                bUiKeyPressLock = false;
            }
        }
    }

    public void clearPropertyAddPoint() {
        imgArray = null;
        sArray = null;
        iArray = null;
        sData = null;
        tempData = null;
        sPlayerNick = null;
    }

    //*****************************角色当前状态******************************************
    public void initBufferList() {
        //#if NOKIA_S60V5
         popWidth = 240;
         popHeight = 300;
         imgArray = new Image[12];
         imgArray[0] = ResManager.createImage(90000017);//背景图片
         imgArray[1] = ResManager.createImage(90000043);//确定、返回图片
         imgArray[2] = ResManager.createImage(90000041);//箭头图片
         imgArray[3] = Tools.makeBlueMask();//蓝色光片
         imgArray[4] = Tools.makeTransparent(Constant.SCREEN_WIDTH, 10, 100, 0x252525);//半透明背景图片
         imgArray[5] = ResManager.createImage(90000047);//数字图片
         imgArray[6] = ResManager.createImage(90000051);
         imgArray[6] = Tools.makeTransparent(imgArray[6], 255);//透明度
         imgArray[7] = Tools.makeTransparent(10, popHeight + popHeight / 10, 255, 0x9C9C9C);
         imgArray[8] = ResManager.createImage(90000044);//图片文字
         imgArray[9] = ResManager.createImage(90000084);//方向键
         imgArray[10] = ResManager.createImage(90000085);//确定键
         imgArray[11] = ResManager.createImage(90000086);//底部蓝条
        //#else
//#        imgArray = new Image[9];
        //#if NOKIA_S40V3 || MOTO || K790
        //#elif NORMAL_240_400
//# //            imgArray[0] = ResManager.createImage(90000017);
//# //            imgArray[0] = Tools.ZoomImage(imgArray[0], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
        //#else
//#        imgArray[0] = ResManager.createImage(90000017);//背景图片
        //#endif
//#        popWidth = 200;
//#        popHeight = 200;
//#        imgArray[1] = ResManager.createImage(90000043);//确定、返回图片
//#        imgArray[2] = ResManager.createImage(90000041);//箭头图片
//#        imgArray[3] = Tools.makeBlueMask();//蓝色光片
//#        imgArray[4] = Tools.makeTransparent(Constant.SCREEN_WIDTH, 10, 100, 0x252525);//半透明背景图片
//#        imgArray[5] = ResManager.createImage(90000047);//数字图片
//#        imgArray[6] = ResManager.createImage(90000051);
//#        imgArray[6] = Tools.makeTransparent(imgArray[6], 255);//透明度
//#        imgArray[7] = Tools.makeTransparent(10, popHeight + popHeight / 10, 255, 0x9C9C9C);
//#        imgArray[8] = ResManager.createImage(90000044);//图片文字
        //#endif
        sArray = new String[]{"在线时长：", "状态名称", "剩余时间", "0", ":", "buffer描述", "确定", "返回",//0 - 7
            "小时", "分钟"// 8 - 9
        };
        byState = 0;

        //测试
//        setNum(15);
//        for (int i = 0; i < nums; i++) {
//            setInfo(i, 323, "双倍经验卡", 3800, 100, "增加经验", (byte) 1);
//            setTime(i, buffTime[i]);
//        }
//        setOnLineTime((short) 80);
    }

    public void setNum(int num) {
        nums = num;
        shCurrentPage = 1;
        if (nums > 0) {
            shTotalPage = (short) (nums % everyPageNum == 0 ? nums / everyPageNum : nums / everyPageNum + 1);
        } else {
            shTotalPage = 1;
        }
        selectNum = nums > everyPageNum ? everyPageNum : nums;
        //#if NOKIA_S60V5
         startY = Constant.UI_START_Y + (41 << 1);
         h = (Constant.END_LINE - startY) / everyPageNum;
        //#else
//#        startY = Constant.UI_START_Y + 51;
//#        h = (Constant.DRAW_HEIGHT - 25 - startY) / everyPageNum;
        //#endif
        if (selectNum == 0) {
            bySelectIndex = (byte) 0;
            //#if NOKIA_S60V5
             iPositionY = Constant.UI_START_Y + 41;
            //#else
//#            iPositionY = Constant.UI_START_Y + 21;
            //#endif
        } else {
            bySelectIndex = 1;
            iPositionY = startY + h;
        }
        bufferId = new long[nums];
        bufferName = new String[nums];
        bufferInfo = new String[nums];
        bufferTime = new String[nums + 1];
        buffTime = new int[nums];
        buffStartTime = new long[nums + 1];
        isChange = new byte[nums];
    }

    public void setInfo(int index, long id, String name, int totleTime, int passTime, String info, byte change) {
        bufferId[index] = id;
        bufferName[index] = name;
        bufferInfo[index] = info;
        buffTime[index] = totleTime - passTime;
        buffStartTime[index] = System.currentTimeMillis() + buffTime[index];
        isChange[index] = change;
    }

    public void setTime(int index, int time) {
        if (time / 60000 > 10) {
            if ((time % 60000) / 1000 >= 10) {
                bufferTime[index] = (time / 60000) + sArray[4] + ((time % 60000) / 1000);
            } else {
                bufferTime[index] = (time / 60000) + sArray[4] + sArray[3] + ((time % 60000) / 1000);
            }
        } else {
            if ((time % 60000) / 1000 >= 10) {
                bufferTime[index] = sArray[3] + (time / 60000) + sArray[4] + ((time % 60000) / 1000);
            } else {
                bufferTime[index] = sArray[3] + (time / 60000) + sArray[4] + sArray[3] + ((time % 60000) / 1000);
            }
        }
    }

    public void setOnLineTime(short onLineTime) {
        this.onLineTime = onLineTime * 60000;
        onLineStartTime = System.currentTimeMillis();
    }

    public void updateOnLineTime(long time) {
        str_onLineTime = (time / (60000 * 60)) + sArray[8] + ((time % (60000 * 60)) / 60000) + sArray[9];
    }

    public void drawBufferList(Graphics g) {
        startX = Constant.UI_START_X + 0;
        startY = Constant.UI_START_Y + 0;
        //绘制背景
        //#if NOKIA_S60V5
         Tools.drawS60V5Frame(g, imgArray[0], imgArray[9], imgArray[10], imgArray[11], imgArray[1], sArray[0] + str_onLineTime);
         h = 41;
         startY += h;
        //#else
//#//        Tools.drawFrame(g, startX, startY, imgArray[0], null, imgArray[3],
//#//                imgArray[1], 0, 0, 24, 12, imgArray[1], 49, 0, 23, 12,
//#//                sArray[0] + str_onLineTime, whiteColor);
//#        Tools.drawFrame(g, imgArray[0], imgArray[3], sArray[6], sArray[7], sArray[0] + str_onLineTime);
//#        h = 21;
//#        startY += h;
//#        h = 30;
        //#endif
        //绘制“状态名称”及“剩余时间”
        w = Constant.DRAW_WIDTH >> 1;
        startY += (h - Constant.FONT_SMALL_HEIGHT >> 1);
        startX += (w - Constant.FONT_SMALL.stringWidth(sArray[1]) >> 1);
        Tools.drawShadowString(g, (byte) 1, sArray[1], startX, startY, selectColor, blackColor);
        startX = Constant.UI_START_X + w + (w - Constant.FONT_SMALL.stringWidth(sArray[2]) >> 1);
        Tools.drawShadowString(g, (byte) 1, sArray[2], startX, startY, selectColor, blackColor);
        //绘制半透明背景
        //#if NOKIA_S60V5
         startY = Constant.UI_START_Y + (h << 1);
         h = Constant.END_LINE - (h << 1);
        //#else
//#        startY = Constant.UI_START_Y + 51;
//#        h = Constant.DRAW_HEIGHT - 76;
        //#endif
        startX = Constant.UI_START_X + 0;
        w = Constant.DRAW_WIDTH;
        Tools.drawTilePic(g, (byte) 2, startX, startY, h, imgArray[4], 0, 0, w, imgArray[4].getHeight(), Constant.TRANS_NONE);
        //绘制内容
        h = h / everyPageNum;
        w = Constant.DRAW_WIDTH >> 1;
        int temp = (shCurrentPage * everyPageNum < nums) ? shCurrentPage * everyPageNum : nums;
        for (int i = (shCurrentPage - 1) * everyPageNum; i < temp; i++) {
            //#if NOKIA_S60V5
             startY = Constant.UI_START_Y + (41 << 1) + (h - Constant.FONT_SMALL_HEIGHT >> 1)
                     + h * (i - (shCurrentPage - 1) * everyPageNum);
            //#else
//#            startY = Constant.UI_START_Y + 51 + (h - Constant.FONT_SMALL_HEIGHT >> 1)
//#                    + h * (i - (shCurrentPage - 1) * everyPageNum);
            //#endif
            startX = Constant.UI_START_X + (w - Constant.FONT_SMALL.stringWidth(bufferName[i]) >> 1);
            Tools.drawShadowString(g, (byte) 1, bufferName[i], startX, startY, whiteColor, blackColor);
            startX = Constant.UI_START_X + w + (w - Constant.FONT_SMALL.stringWidth(bufferTime[i]) >> 1);
            Tools.drawShadowString(g, (byte) 1, bufferTime[i], startX, startY, whiteColor, blackColor);
        }
        //绘制翻页
        //#if NOKIA_S60V5
         startY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - 57 + (57 - imgArray[5].getHeight() >> 1);
        //#else
//#        startY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - 25 + (25 - imgArray[5].getHeight() >> 1);
        //#endif
        startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Tools.getPageStrWidth(shTotalPage, shCurrentPage) >> 1);
        Tools.drawPage(g, shTotalPage, shCurrentPage, imgArray[5], imgArray[2], startX, startY);
        //绘制选择条
        if (bySelectIndex == 0) {
            //#if NOKIA_S60V5
             Tools.drawGapSlectMask(g, imgArray[3], null, false, 41, Constant.UI_START_X, iPositionY, Constant.DRAW_WIDTH);
            //#else
//#            Tools.drawGapSlectMask(g, imgArray[3], null, false, 30, Constant.UI_START_X, iPositionY, Constant.DRAW_WIDTH);
            //#endif
        } else {
            Tools.drawSelectMask(g, (byte) 1, imgArray[3], Constant.UI_START_X, iPositionY, Constant.DRAW_WIDTH);
        }
        if (byState == 1) {
            startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - popWidth >> 1);
            //#if NOKIA_S60V5
             startY = Constant.UI_START_Y + (Constant.END_LINE - popHeight >> 1);
            //#else
//#            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - popHeight >> 1);
            //#endif
            Tools.drawPopUp(g, byPopUpState, startX, startY, popWidth, popHeight, imgArray[6], 0x9C9C9C,
                    imgArray[8], 22, 0, 21, 10, imgArray[8], 0, 0, 22, 10,
                    sArray[5], bufferInfo[(bySelectIndex - 1) + (shCurrentPage - 1) * everyPageNum]);
        } else if (byState == 2) {
            int index = (bySelectIndex - 1) - (shCurrentPage - 1) * everyPageNum;
            //#if NOKIA_S60V5
             startY = Constant.UI_START_Y + (41 << 1) + (h - Constant.FONT_SMALL_HEIGHT >> 1) + h * index;
            //#else
//#            startY = Constant.UI_START_Y + 51 + (h - Constant.FONT_SMALL_HEIGHT >> 1)
//#                    + h * index;
            //#endif
            w = Constant.DRAW_WIDTH >> 1;
            startX = Constant.UI_START_X + (w - Constant.FONT_SMALL.stringWidth(bufferName[index]) >> 1);

            h = Constant.FONT_SMALL_HEIGHT;
            w = Constant.FONT_SMALL.stringWidth(sOpArray[0]);
            Tools.drawPopMenu(g, sOpArray, (byte) 1, w, h,
                    blackColor, whiteColor, selectColor, bySubSelectIndex, startX, startY);
        }
    }

    public void updateBufferList() {
        if (byState == 1) {
            if (byPopUpState < 4) {
                byPopUpState++;
                MainCanvas.clearInput();
            }
        }
        endTime = System.currentTimeMillis();
        for (int i = 0; i < buffTime.length; i++) {
            if (buffTime[i] > 0) {
                buffTime[i] = (int) (buffStartTime[i] - endTime);
                setTime(i, buffTime[i]);
            }
        }
        updateOnLineTime(endTime - onLineStartTime + onLineTime);
        if (!bUiKeyPressLock) {
            if (byState == 0) {
                if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                    bUiKeyPressLock = true;
                    if (bySelectIndex == 0) {
                        return;
                    } else {
                        bySelectIndex = (byte) (bySelectIndex == 1 ? selectNum : (bySelectIndex - 1));
                        //#if NOKIA_S60V5
                         startY = Constant.UI_START_Y + (41 << 1);
                         h = (Constant.END_LINE - startY) / everyPageNum;
                        //#else 
//#                        startY = Constant.UI_START_Y + 51;
//#                        h = (Constant.DRAW_HEIGHT - 25 - startY) / everyPageNum;
                        //#endif
                        startY += (h * bySelectIndex);
                    }
                    iArray = new int[]{2, 1, startY, 2, 50, 5};
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                    bUiKeyPressLock = true;
                    if (bySelectIndex == 0) {
                        return;
                    } else {
                        bySelectIndex = (byte) (bySelectIndex == selectNum ? 1 : (bySelectIndex + 1));
                        //#if NOKIA_S60V5
                         startY = Constant.UI_START_Y + (41 << 1);
                         h = (Constant.END_LINE - startY) / everyPageNum;
                        //#else 
//#                        startY = Constant.UI_START_Y + 51;
//#                        h = (Constant.DRAW_HEIGHT - 25 - startY) / everyPageNum;
                        //#endif
                        startY += (h * bySelectIndex);
                    }
                    iArray = new int[]{1, 1, startY, 2, 50, 5};
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_LEFT, false)) {
                    bUiKeyPressLock = true;
                    if (shCurrentPage > 1) {
                        shCurrentPage--;
                        selectNum = shCurrentPage * everyPageNum < nums ? everyPageNum : nums - (shCurrentPage - 1) * everyPageNum;
                        bySelectIndex = 1;
                        //#if NOKIA_S60V5
                         startY = Constant.UI_START_Y + (41 << 1);
                         h = (Constant.END_LINE - startY) / everyPageNum;
                        //#else
//#                        startY = Constant.UI_START_Y + 51;
//#                        h = (Constant.DRAW_HEIGHT - 25 - startY) / everyPageNum;
                        //#endif
                        iPositionY = startY + h;
                    }
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_RIGHT, false)) {
                    bUiKeyPressLock = true;
                    if (shCurrentPage < shTotalPage) {
                        shCurrentPage++;
                        selectNum = shCurrentPage * everyPageNum < nums ? everyPageNum : nums - (shCurrentPage - 1) * everyPageNum;
                        bySelectIndex = 1;
                        //#if NOKIA_S60V5
                         startY = Constant.UI_START_Y + (41 << 1);
                         h = (Constant.END_LINE - startY) / everyPageNum;
                        //#else
//#                        startY = Constant.UI_START_Y + 51;
//#                        h = (Constant.DRAW_HEIGHT - 25 - startY) / everyPageNum;
                        //#endif
                        iPositionY = startY + h;
                    }
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                        || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)
                        || MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)) {
                    bUiKeyPressLock = true;
                    if (isChange[(bySelectIndex - 1) + (shCurrentPage - 1) * everyPageNum] == 1) {//可变身
                        sOpArray = new String[]{"查看", "卸载"};
                        bySubSelectIndex = 0;
                        byState = 2;
                    } else {
                        byState = 1;
                    }
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                    Tools.openRoamMenu(false, (byte) 1, (byte) 2, 3);
                }
            } else if (byState == 1) {
                if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                        || MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)
                        || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                        || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {
                    bUiKeyPressLock = true;
                    byState = 0;
                    byPopUpState = 0;
                }
            } else if (byState == 2) {
                if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                    bySubSelectIndex = Tools.updatePopMenu((byte) sOpArray.length, bySubSelectIndex, (byte) 0);
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                    bySubSelectIndex = Tools.updatePopMenu((byte) sOpArray.length, bySubSelectIndex, (byte) 1);
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                        || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                        || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {
                    if (bySubSelectIndex == 0) {//查看
                        byState = 1;
                        sOpArray = null;
                    } else if (bySubSelectIndex == 1) {//卸载buffer
                        GameBean.L_BUFFER_ID = bufferId[(bySelectIndex - 1) + (shCurrentPage - 1) * everyPageNum];
                        MainLogic.getInstance().send(Constant.MSG_NET_CMD_DELETE_BUFF, Constant.SOCKET_MSG_TYPE_LOGIC);
                        byState = 0;
                        sOpArray = null;
                        MainLogic.getInstance().send(Constant.MSG_NET_CMD_CHECK_MEFFECT, Constant.SOCKET_MSG_TYPE_LOGIC);
                    }
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                    byState = 0;
                    sOpArray = null;
                }
            }
        } else {
            iPositionY = Tools.updateLinePos(iArray, iPositionY);
            if (iArray == null || iArray[1] == 0) {
                bUiKeyPressLock = false;
            }
        }
    }

    public void clearBufferList() {
        this.sArray = null;
        this.imgArray = null;
        buffTime = null;
        buffStartTime = null;
        bufferInfo = null;
        bufferName = null;
        bufferTime = null;
        str_onLineTime = null;
        bufferId = null;
        isChange = null;
        sOpArray = null;
    }

    /***************************玩家的排行榜******************************************************/
    public void openPlayerTop(byte byBigPlayerTopType) {
        GameBean.b_WAIT_NET_MSG_BACK = false;
        byState = 0;
        if (MainLogic.getInstance().byGameState != Constant.GAME_UI_PLAYER_TOP) {
            this.bySelectIndex = 1;
            MainLogic.getInstance().pushState(Constant.GAME_UI_PLAYER_TOP, true);
        } else {
            this.bySelectIndex = (byte) tempData[3];
        }
        this.byPlayBigTopType = byBigPlayerTopType;
        switch (byBigPlayerTopType) {
            case 1://神之等级
                this.sArray = new String[]{"神之等级"};
                this.sData = new String[]{"1 神之最强", "2 最强勇士", "3 最强女神", "4 最强武师", "5 最强刺客", "6 最强术士"};
                this.tempData = new int[]{1, 2, 3, 4, 5, 6};
                break;
            case 2://神之财富
                this.sArray = new String[]{"神之财富榜"};
                this.sData = new String[]{"1 富可敌国", "2 豪门少爷", "3 巅峰富婆"};
                this.tempData = new int[]{7, 8, 9};
                break;
            case 3://神之杀戮
                this.sArray = new String[]{"神之杀戮榜"};
                this.sData = new String[]{"1 杀戮之神", "2 修罗魔神", "3 罗刹杀神"};
                this.tempData = new int[]{10, 11, 12};
                break;
            case 4://神之帮派
                this.sArray = new String[]{"神之帮派榜"};
                this.sData = new String[]{"1 天下第一"};
                this.tempData = new int[]{13};
                break;
        }
        //#if NOKIA_S60V5
         this.iStartPointY = Constant.UI_START_Y + ((Constant.END_LINE - sData.length * (Constant.FONT_SMALL_HEIGHT + 5)) >> 1);
        //#else
//#        this.iStartPointY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - sData.length * (Constant.FONT_SMALL_HEIGHT + 5)) >> 1);
        //#endif
        this.iPositionY = this.iStartPointY + (Constant.FONT_SMALL_HEIGHT + 5) * this.bySelectIndex - 3;
    }
    public byte byPlayerTopType;//小类型
    public byte byPlayBigTopType;//大类型
    public int iStartPointY;
    public byte byNumPerPage;
    public String[] sOpArray;

    public void initPlayerTop() {
        //#if NOKIA_S60V5
         popWidth = 240;
         popHeight = 300;
         imgArray = new Image[12];
         imgArray[0] = ResManager.createImage(90000017);//背景图片
         imgArray[1] = ResManager.createImage(90000043);//确定、返回图片
         imgArray[2] = ResManager.createImage(90000041);//箭头图片
         imgArray[3] = Tools.makeBlueMask();//蓝色光片
         imgArray[4] = Tools.makeTransparent(Constant.SCREEN_WIDTH, 20, 180, 0x000000);//半透明背景图片
         imgArray[5] = ResManager.createImage(90000047);//数字图片
         imgArray[6] = ResManager.createImage(90000051);
         imgArray[6] = Tools.makeTransparent(imgArray[6], 255);//透明度
         imgArray[9] = ResManager.createImage(90000084);//方向键
         imgArray[10] = ResManager.createImage(90000085);//确定键
         imgArray[11] = ResManager.createImage(90000086);//底部蓝条
        //#else
//#        imgArray = new Image[9];
        //#if NOKIA_S40V3 || MOTO || K790
        //#elif NORMAL_240_400
//# //            imgArray[0] = ResManager.createImage(90000017);
//# //            imgArray[0] = Tools.ZoomImage(imgArray[0], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
        //#else
//#        imgArray[0] = ResManager.createImage(90000017);//背景图片
        //#endif
//#        imgArray[1] = ResManager.createImage(90000043);//确定、返回图片
//#        imgArray[2] = ResManager.createImage(90000041);//箭头图片
//#        imgArray[3] = Tools.makeBlueMask();//蓝色光片
//#        imgArray[4] = Tools.makeTransparent(Constant.SCREEN_WIDTH, 20, 180, 0x000000);//半透明背景图片
//#        imgArray[5] = ResManager.createImage(90000047);//数字图片
//#        imgArray[6] = ResManager.createImage(90000051);
//#        imgArray[6] = Tools.makeTransparent(imgArray[6], 255);//透明度
//#        imgArray[8] = ResManager.createImage(90000044);//图片文字
        //#endif
    }

    private void openSubPlayerTop(byte byPlayerTopType) {
        this.byState = 1;
        this.byPlayerTopType = byPlayerTopType;
        this.shCurrentPage = 1;
        this.shTotalPage = 1;
        //#if NOKIA_S60V5
         byNumPerPage = 10;
        //#elif NOKIA_E72
//#         byNumPerPage = 6;
        //#else
//#        byNumPerPage = 8;
        //#endif
        //#if NOKIA_S60V5
         iStartPointY = Constant.UI_START_Y + 50;
        //#else
//#        iStartPointY = Constant.UI_START_Y + 25;
        //#endif

        switch (this.byPlayerTopType) {
            case 1:
                this.tempData = new int[]{0, 4, 0, this.bySelectIndex};
                sArray = new String[]{"神之最强", "等级最高的玩家", "名称", "职业", "等级"};
                break;
            case 2:
                this.tempData = new int[]{0, 4, 0, this.bySelectIndex};
                sArray = new String[]{"最强勇士", "男性角色等级最高的玩家", "名称", "职业", "等级"};
                break;
            case 3:
                this.tempData = new int[]{0, 4, 0, this.bySelectIndex};
                sArray = new String[]{"最强女神", "女性角色等级最高的玩家", "名称", "职业", "等级"};
                break;
            case 4:
                this.tempData = new int[]{0, 3, 0, this.bySelectIndex};
                sArray = new String[]{"最强武师", "武师职业等级最高的玩家", "名称", "等级"};
                break;
            case 5:
                this.tempData = new int[]{0, 3, 0, this.bySelectIndex};
                sArray = new String[]{"最强刺客", "刺客职业等级最高的玩家", "名称", "等级"};
                break;
            case 6:
                this.tempData = new int[]{0, 3, 0, this.bySelectIndex};
                sArray = new String[]{"最强术士", "术士职业等级最高的玩家", "名称", "等级"};
                break;
            case 7:
                this.tempData = new int[]{0, 4, 0, this.bySelectIndex};
                sArray = new String[]{"富可敌国", "金钱最多的玩家", "名称", "性别", "龙币"};
                break;
            case 8:
                this.tempData = new int[]{0, 3, 0, this.bySelectIndex};
                sArray = new String[]{"豪门少爷", "男性角色金钱最多的玩家", "名称", "龙币"};
                break;
            case 9:
                this.tempData = new int[]{0, 3, 0, this.bySelectIndex};
                sArray = new String[]{"巅峰富婆", "女性角色金钱最多的玩家", "名称", "龙币"};
                break;
            case 10:
                this.tempData = new int[]{0, 3, 0, this.bySelectIndex};
                sArray = new String[]{"杀戮之神", "Pk值最高的玩家", "名称", "PK值"};
                break;
            case 11:
                this.tempData = new int[]{0, 3, 0, this.bySelectIndex};
                sArray = new String[]{"修罗魔神", "男性角色Pk值最高的玩家", "名称", "PK值"};
                break;
            case 12:
                this.tempData = new int[]{0, 3, 0, this.bySelectIndex};
                sArray = new String[]{"罗刹杀神", "女性角色pk值最高的玩家", "名称", "PK值"};
                break;
            case 13:
                this.tempData = new int[]{0, 4, 0, this.bySelectIndex};
                sArray = new String[]{"天下第一", "帮派排名榜", "帮派名", "等级", "人数"};
                break;
        }
        if (this.byPlayerTopType != 13) {
            sOpArray = new String[]{"1 查看", "2 加为好友"};
        } else {
            sOpArray = new String[]{"1 查看"};
        }
        this.bySelectIndex = -1;
        this.byPlayerTopType = byPlayerTopType;
        GameBean.BY_TYPE = byPlayerTopType;
        MainLogic.getInstance().send(Constant.MSG_NET_CMD_PLAYER_TOP, Constant.SOCKET_MSG_TYPE_LOGIC);
//        setPlayerTopData(new String[]{"11111", "1上台打孔", "刺客", "22222", "11111", "2上台打孔", "刺客", "22222", "11111", "3上台打孔", "刺客", "22222", "11111", "4上台打孔", "刺客", "22222", "11111", "5上台打孔", "刺客", "22222", "11111", "6上台打孔", "刺客", "22222", "11111", "7上台打孔", "刺客", "22222", "11111", "8上台打孔", "刺客", "22222", "11111", "9上台打孔", "刺客", "22222", "11111", "10上台打孔", "刺客", "22222", "11111", "11上台打孔", "刺客", "22222", "11111", "12上台打孔", "刺客", "22222", "11111", "13上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222", "11111", "上台打孔", "刺客", "22222"}, (byte) 4);
    }

    public void setPlayerTopData(String[] sList, byte byFieldNum) {
        if (MainLogic.getInstance().byGameState == Constant.GAME_UI_PLAYER_TOP && this.byState == 1) {
            this.bySelectIndex = 1;
            this.shCurrentPage = 1;
            this.sData = sList;
            this.tempData[0] = this.sData.length;
            this.tempData[1] = byFieldNum;
            this.tempData[2] = this.sData.length / byFieldNum;
            this.shTotalPage = (short) Tools.ceil(this.tempData[2], this.byNumPerPage);
            this.iPositionY = this.iStartPointY + Constant.FONT_SMALL_HEIGHT * 2 + 7 + (Constant.FONT_SMALL_HEIGHT + 5) * this.bySelectIndex;
       
            ///////////////
            //Yujiang
            setPlayTopTouchItemRect();
        }
    }
    
    public void updatePlayerTop() {
    	
        if (!GameBean.b_WAIT_NET_MSG_BACK) {
            switch (this.byState) {
                case 0:
                    if (!bUiKeyPressLock) {
                        if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                            bUiKeyPressLock = true;
                            if (bySelectIndex > 1) {
                                bySelectIndex--;
                                this.bUiKeyPressLock = true;
                                iArray = new int[]{2, 2, this.iStartPointY + (Constant.FONT_SMALL_HEIGHT + 5) * this.bySelectIndex - 3, 2, 50, 5};
                            }
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                            if (bySelectIndex < this.sData.length) {
                                bySelectIndex++;
                                this.bUiKeyPressLock = true;
                                iArray = new int[]{2, 1, this.iStartPointY + (Constant.FONT_SMALL_HEIGHT + 5) * this.bySelectIndex - 3, 2, 50, 5};
                            }
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_1, false) && this.bySelectIndex > 1) {
                            this.bUiKeyPressLock = true;
                            this.bySelectIndex = 1;
                            iArray = new int[]{2, 2, this.iStartPointY + Constant.FONT_SMALL_HEIGHT + 2, 2, 50, 5};
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_2, false) && this.sData.length >= 2 && this.bySelectIndex != 2) {
                            this.bUiKeyPressLock = true;
                            this.bySelectIndex = 2;
                            if (bySelectIndex > 2) {
                                iArray = new int[]{2, 2, this.iStartPointY + (Constant.FONT_SMALL_HEIGHT + 5) * 2 - 3, 2, 50, 5};
                            } else {
                                iArray = new int[]{2, 1, this.iStartPointY + (Constant.FONT_SMALL_HEIGHT + 5) * 2 - 3, 2, 50, 5};
                            }
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_3, false) && this.sData.length >= 3 && this.bySelectIndex != 3) {
                            this.bUiKeyPressLock = true;
                            this.bySelectIndex = 3;
                            if (bySelectIndex > 3) {
                                iArray = new int[]{2, 2, this.iStartPointY + (Constant.FONT_SMALL_HEIGHT + 5) * 3 - 3, 2, 50, 5};
                            } else {
                                iArray = new int[]{2, 1, this.iStartPointY + (Constant.FONT_SMALL_HEIGHT + 5) * 3 - 3, 2, 50, 5};
                            }
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_4, false) && this.sData.length >= 4 && this.bySelectIndex != 4) {
                            this.bUiKeyPressLock = true;
                            this.bySelectIndex = 4;
                            if (bySelectIndex > 4) {
                                iArray = new int[]{2, 2, this.iStartPointY + (Constant.FONT_SMALL_HEIGHT + 5) * 4 - 3, 2, 50, 5};
                            } else {
                                iArray = new int[]{2, 1, this.iStartPointY + (Constant.FONT_SMALL_HEIGHT + 5) * 4 - 3, 2, 50, 5};
                            }
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false) && this.sData.length >= 5 && this.bySelectIndex != 5) {
                            this.bUiKeyPressLock = true;
                            this.bySelectIndex = 5;
                            if (bySelectIndex > 5) {
                                iArray = new int[]{2, 2, this.iStartPointY + (Constant.FONT_SMALL_HEIGHT + 5) * 5 - 3, 2, 50, 5};
                            } else {
                                iArray = new int[]{2, 1, this.iStartPointY + (Constant.FONT_SMALL_HEIGHT + 5) * 5 - 3, 2, 50, 5};
                            }
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_6, false) && this.sData.length >= 6 && this.bySelectIndex != 6) {
                            this.bUiKeyPressLock = true;
                            this.bySelectIndex = 6;
                            iArray = new int[]{2, 1, this.iStartPointY + (Constant.FONT_SMALL_HEIGHT + 5) * 6 - 3, 2, 50, 5};
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)) {
                            if (this.bySelectIndex >= 1 && this.bySelectIndex <= this.sData.length) {
                                this.openSubPlayerTop((byte) this.tempData[this.bySelectIndex - 1]);
                                
                          
                            }
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                            Tools.openRoamMenu(false, (byte) 2, (byte) 1, this.byPlayBigTopType);
                        }

                    } else {
                        iPositionY = Tools.updateLinePos(iArray, iPositionY);
                        if (iArray == null || iArray[1] == 0) {
                            bUiKeyPressLock = false;
                        }
                    }
                    break;
                case 1:
                    if (!bUiKeyPressLock) {
                    	
                        if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                            bUiKeyPressLock = true;
                            if (bySelectIndex > 1) {
                                bySelectIndex--;
                                if (this.bySelectIndex + (this.shCurrentPage - 1) * this.byNumPerPage > this.tempData[2]) {
                                    this.bySelectIndex = (byte) (this.tempData[2] - (this.shCurrentPage - 1) * this.byNumPerPage);
                                }
                                this.bUiKeyPressLock = true;
                                iArray = new int[]{2, 2, this.iStartPointY + Constant.FONT_SMALL_HEIGHT * 2 + 7 + (Constant.FONT_SMALL_HEIGHT + 5) * this.bySelectIndex, 2, 50, 5};
                            }
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                            if (this.bySelectIndex != this.byNumPerPage && this.bySelectIndex + 1 + (this.shCurrentPage - 1) * this.byNumPerPage > this.tempData[2]) {
                                bySelectIndex = (byte) (this.byNumPerPage + 1);
                                this.bUiKeyPressLock = true;
                                iArray = new int[]{2, 1, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 5, 2, 50, 5};
                            } else {
                                if (bySelectIndex < this.byNumPerPage + 1) {
                                    bySelectIndex++;
                                    this.bUiKeyPressLock = true;
                                    if (bySelectIndex != this.byNumPerPage + 1) {
                                        iArray = new int[]{2, 1, this.iStartPointY + Constant.FONT_SMALL_HEIGHT * 2 + 7 + (Constant.FONT_SMALL_HEIGHT + 5) * this.bySelectIndex, 2, 50, 5};
                                    } else {
                                        iArray = new int[]{2, 1, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 5, 2, 50, 5};
                                    }
                                }
                            }
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_LEFT, false)) {
                            if (this.shCurrentPage > 1) {
                                this.shCurrentPage--;
                                this.iPositionY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - 5;
                                this.bySelectIndex = (byte) (this.byNumPerPage + 1);
                                ////////////////
                                //Yujiang
                                setPlayTopTouchItemRect();
                            }
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_RIGHT, false)) {
                            if (this.shCurrentPage < this.shTotalPage) {
                                this.shCurrentPage++;
                                this.iPositionY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - 5;
                                this.bySelectIndex = (byte) (this.byNumPerPage + 1);
                                ////////////////
                                //Yujiang
                                setPlayTopTouchItemRect();
                            }
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)) {
                            if (this.bySelectIndex >= 1 && this.bySelectIndex <= this.byNumPerPage) {
                                byState = 2;
                                this.bySubSelectIndex = 1;
                                //#if NOKIA_E72
//#                                 this.iPositionY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - this.sOpArray.length * 30 - 7) >> 1) + 7;
                                //#elif NOKIA_S60V5
                                 this.iPositionY = Constant.UI_START_Y + ((Constant.END_LINE - this.sOpArray.length * 30 - 7) >> 1) + 7;
                                //#else
//#                                this.iPositionY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - this.sOpArray.length * 30 - 7) >> 1) + 7;
                                //#endif
                            }
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                            this.openPlayerTop(this.byPlayBigTopType);
                        }
                    } else {
                        iPositionY = Tools.updateLinePos(iArray, iPositionY);
                        if (iArray == null || iArray[1] == 0) {
                            bUiKeyPressLock = false;
                        }
                    }
                    break;
                case 2:
                    if (!bUiKeyPressLock) {
                        if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_1, false)) {
                            bUiKeyPressLock = true;
                            if (bySubSelectIndex > 1) {
                                bySelectIndex--;
                                this.bUiKeyPressLock = true;
                                this.bySubSelectIndex = 1;
                                //#if NOKIA_S60V5
                                 iArray = new int[]{2, 2, Constant.UI_START_Y + ((Constant.END_LINE - this.sOpArray.length * 30 - 7) >> 1) + 7, 2, 50, 5};
                                //#else
//#                                iArray = new int[]{2, 2, Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - this.sOpArray.length * 30 - 7) >> 1) + 7, 2, 50, 5};
                                //#endif
                            }

                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_2, false)) {
                            if (bySubSelectIndex < this.sOpArray.length) {
                                bySubSelectIndex++;
                                this.bUiKeyPressLock = true;
                                this.bySubSelectIndex = 2;
                                //#if NOKIA_S60V5
                                 iArray = new int[]{2, 1, Constant.UI_START_Y + ((Constant.END_LINE - this.sOpArray.length * 30 - 7) >> 1) + 7 + 30, 2, 50, 5};
                                //#else
//#                                iArray = new int[]{2, 1, Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - this.sOpArray.length * 30 - 7) >> 1) + 7 + 30, 2, 50, 5};
                                //#endif
                            }
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)) {
                            switch (this.bySubSelectIndex) {
                                case 1:
                                    if (this.byPlayerTopType != 13) {
                                        GameBean.b_WAIT_NET_MSG_BACK = true;
                                        GameBean.L_PLAYER_ID = Long.parseLong(this.sData[((this.shCurrentPage - 1) * this.byNumPerPage + this.bySelectIndex - 1) * this.tempData[1]]);
                                        if (GameBean.L_PLAYER_ID == MainLogic.getInstance().gamePlayer.lPlayerID) {
                                            GameBean.BY_PRE_GAME_UI_STATE = Constant.GAME_UI_PLAYER_TOP;
                                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_OPEN_EQUIP, Constant.SOCKET_MSG_TYPE_LOGIC);
                                        } else {
                                            GameBean.BY_PRE_GAME_UI_STATE = Constant.GAME_UI_PLAYER_TOP;
                                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_OTHER_PLAYER_DETAIL, Constant.SOCKET_MSG_TYPE_LOGIC);
                                        }
                                    } else {
                                        GameBean.BY_PRE_GAME_UI_STATE = Constant.GAME_UI_PLAYER_TOP;
                                        GameBean.L_CMD_TONG_ID = Long.parseLong(this.sData[((this.shCurrentPage - 1) * this.byNumPerPage + this.bySelectIndex - 1) * this.tempData[1]]);
                                        MainLogic.getInstance().send(Constant.MSG_NET_CMD_TONG_DESCRIPT, Constant.SOCKET_MSG_TYPE_LOGIC);
                                    }
                                    break;
                                case 2:
                                    GameBean.L_PLAYER_ID = Long.parseLong(this.sData[((this.shCurrentPage - 1) * this.byNumPerPage + this.bySelectIndex - 1) * this.tempData[1]]);
                                    if (GameBean.L_PLAYER_ID == MainLogic.getInstance().gamePlayer.lPlayerID) {
                                        MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "您不能添加自己为好友!");
                                    } else {
                                        GameBean.b_WAIT_NET_MSG_BACK = true;
                                        GameBean.BY_CMD_FRIEND_MODE = 1;
                                        GameBean.BY_CMD_FRIEND_TYPE = 1;
                                        GameBean.BY_CMD_FRIEND_NAME = this.sData[((this.shCurrentPage - 1) * this.byNumPerPage + this.bySelectIndex - 1) * this.tempData[1] + 1];
                                        MainLogic.getInstance().send(Constant.MSG_NET_CMD_ADD_FRIEND, Constant.SOCKET_MSG_TYPE_LOGIC);
                                    }
                                    break;
                            }
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                            this.byState = 1;
                            if (bySelectIndex != this.byNumPerPage + 1) {
                                this.iPositionY = this.iStartPointY + Constant.FONT_SMALL_HEIGHT * 2 + 7 + (Constant.FONT_SMALL_HEIGHT + 5) * this.bySelectIndex;
                            } else {
                                this.iPositionY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - 5;
                            }
                        }

                    } else {
                        iPositionY = Tools.updateLinePos(iArray, iPositionY);
                        if (iArray == null || iArray[1] == 0) {
                            bUiKeyPressLock = false;
                        }
                    }
                    break;
            }
        }

    }

    public void drawPlayerTop(Graphics g) {
        //#if NOKIA_S60V5
         Tools.drawS60V5Frame(g, imgArray[0], imgArray[9], imgArray[10], imgArray[11], imgArray[1], sArray[0]);
         h = 41;
         startY += h;
        //#elif NOKIA_E72
//#         Tools.drawE72Frame(g, imgArray[0], imgArray[1], sArray[0]);
        //#else
//#        Tools.drawFrame(g, Constant.UI_START_X, Constant.UI_START_Y, imgArray[0], null, imgArray[3], imgArray[1], 0, 0, 24, 12, imgArray[1], 49, 0, 23, 12, sArray[0], whiteColor);
        //#endif
        switch (this.byState) {
            case 0:
                this.startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(this.sData[0]) >> 1);
                //#if NOKIA_S60V5
                 this.startY = Constant.UI_START_Y + ((Constant.END_LINE - sData.length * (Constant.FONT_SMALL_HEIGHT + 5)) >> 1);
                //#else
//#                this.startY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - sData.length * (Constant.FONT_SMALL_HEIGHT + 5)) >> 1);
                //#endif
                for (byte i = 0; i < sData.length; i++) {
                    Tools.drawShadowString(g, (byte) 1, sData[i], startX, startY, i + 1 == this.bySelectIndex ? selectColor : this.whiteColor, this.blackColor);
                    startY += Constant.FONT_SMALL_HEIGHT + 5;
                }
                Tools.drawSelectMask(g, (byte) 1, imgArray[3], Constant.UI_START_X, this.iPositionY, Constant.DRAW_WIDTH);
                break;
            case 1:
            case 2:
                //绘制描述信息
                Tools.drawShadowString(g, (byte) 1, this.sArray[1], Constant.UI_START_X + ((Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(this.sArray[1]) >> 1)), this.iStartPointY, this.whiteColor, this.blackColor);
                Tools.drawSelectMask(g, (byte) 1, imgArray[3], Constant.UI_START_X, this.iStartPointY + Constant.FONT_SMALL_HEIGHT + 3, Constant.DRAW_WIDTH);
                startY = this.iStartPointY + Constant.FONT_SMALL_HEIGHT + 5;
                //绘制标题
                if (tempData[1] == 4) {
                    Tools.drawShadowString(g, (byte) 1, this.sArray[2], Constant.UI_START_X + 20, startY, this.whiteColor, this.blackColor);
                    Tools.drawShadowString(g, (byte) 1, this.sArray[3], Constant.UI_START_X + Constant.DRAW_WIDTH - 20, startY, this.whiteColor, this.blackColor, Graphics.TOP | Graphics.RIGHT);
                } else {
                    Tools.drawShadowString(g, (byte) 1, this.sArray[2], Constant.UI_START_X + 10, startY, this.whiteColor, this.blackColor);
                    Tools.drawShadowString(g, (byte) 1, this.sArray[3], Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(this.sArray[3]) >> 1), startY, this.whiteColor, this.blackColor);
                    Tools.drawShadowString(g, (byte) 1, this.sArray[4], Constant.UI_START_X + Constant.DRAW_WIDTH - 10, startY, this.whiteColor, this.blackColor, Graphics.TOP | Graphics.RIGHT);
                }
                if (this.tempData[0] > 0) {
                    startY += Constant.FONT_SMALL_HEIGHT + 5;
                    int start = (this.shCurrentPage - 1) * this.byNumPerPage;
                    int end = this.shCurrentPage * this.byNumPerPage > this.tempData[2] ? this.tempData[2] : this.shCurrentPage * this.byNumPerPage;
//                    boolean bSelected;
                    byte byOnLine;
                    for (int i = start; i < end; i++) {
                        if (this.tempData[1] == 4) {
                            byOnLine = Byte.parseByte(this.sData[i * this.tempData[1] + 3]);
//                            bSelected = i - (this.shCurrentPage - 1) * this.byNumPerPage + 1 == this.bySelectIndex;
                            Tools.drawShadowString(g, (byte) 1, this.sData[i * this.tempData[1] + 1], Constant.UI_START_X + 20, startY, byOnLine != 1 ? 0x999999 : this.whiteColor, this.blackColor);
                            Tools.drawShadowString(g, (byte) 1, this.sData[i * this.tempData[1] + 2], Constant.UI_START_X + Constant.DRAW_WIDTH - 20, startY, byOnLine != 1 ? 0x999999 : this.whiteColor, this.blackColor, Graphics.TOP | Graphics.RIGHT);
                        } else {
//                            bSelected = i - (this.shCurrentPage - 1) * this.byNumPerPage + 1 == this.bySelectIndex;
                            if (this.byPlayerTopType != 13) {
                                byOnLine = Byte.parseByte(this.sData[i * this.tempData[1] + 4]);
                            } else {
                                byOnLine = 1;
                            }
                            Tools.drawShadowString(g, (byte) 1, this.sData[i * this.tempData[1] + 1], Constant.UI_START_X + 10, startY, byOnLine != 1 ? 0x999999 : this.whiteColor, this.blackColor);
                            Tools.drawShadowString(g, (byte) 1, this.sData[i * this.tempData[1] + 2], Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(this.sArray[2]) >> 1), startY, byOnLine != 1 ? 0x999999 : this.whiteColor, this.blackColor);
                            Tools.drawShadowString(g, (byte) 1, this.sData[i * this.tempData[1] + 3], Constant.UI_START_X + Constant.DRAW_WIDTH - 10, startY, byOnLine != 1 ? 0x999999 : this.whiteColor, this.blackColor, Graphics.TOP | Graphics.RIGHT);
                        }
                        startY += (Constant.FONT_SMALL_HEIGHT + 5);
                    }
                }
                //#if NOKIA_S60V5
                 Tools.drawPage(g, shTotalPage, shCurrentPage, this.imgArray[5], this.imgArray[2], Constant.UI_START_X + ((Constant.DRAW_WIDTH - Tools.getPageStrWidth(shTotalPage, shCurrentPage)) >> 1), Constant.DRAW_HEIGHT - 17);
                //#else
//#                Tools.drawPage(g, shTotalPage, shCurrentPage, this.imgArray[5], this.imgArray[2], Constant.UI_START_X + ((Constant.DRAW_WIDTH - Tools.getPageStrWidth(shTotalPage, shCurrentPage)) >> 1), Constant.DRAW_HEIGHT - 19);
                //#endif
                if (this.bySelectIndex != -1 && this.byState != 2) {
                    Tools.drawSelectMask(g, (byte) 1, imgArray[3], Constant.UI_START_X, this.iPositionY, Constant.DRAW_WIDTH);
                }
                if (this.byState == 2) {
                    //#if NOKIA_S60V5
                     Tools.drawTilePic(g, (byte) 2, Constant.UI_START_X, Constant.UI_START_Y, Constant.END_LINE, imgArray[4], 0, 0, imgArray[4].getWidth(), imgArray[4].getHeight(), Constant.TRANS_NONE);
                    //#else
//#                    Tools.drawTilePic(g, (byte) 2, Constant.UI_START_X, Constant.UI_START_Y, Constant.DRAW_HEIGHT, imgArray[4], 0, 0, imgArray[4].getWidth(), imgArray[4].getHeight(), Constant.TRANS_NONE);
                    //#endif
                    Tools.drawPopOperation(g, imgArray[6], 0x989898, 0x666666, this.sOpArray, 90, 23, 7, 0xFFFFFF, 0x00ccff, bySubSelectIndex, 0, 0);
                    Tools.drawGapSlectMask(g, imgArray[3], imgArray[2], true, 23, Constant.UI_START_X, this.iPositionY, Constant.DRAW_WIDTH);
               
                    MainView.drawTouchRect(g, mPlayTopTouchPopMenuRect);
                }
                else
                {            
	                MainView.drawTouchRect(g, mPlayTopTouchItemRect);
	                MainView.drawTouchRect(g, mPlayTopTouchPageRect);
                }
               
                
                break;
        }
    }

    public void clearPlayerTop() {
        this.sData = null;
        this.tempData = null;
        this.imgArray = null;
        this.sOpArray = null;
        this.sArray = null;
        this.iArray = null;
    }
    /*************************************挂机界面***************************************/
    public Goods hangUpGoods;
    public static Image[] goodsIcon = new Image[9];//药品图标
    public static byte[] goodsColor = new byte[9];//药品颜色
    public static short[] goodsNum = new short[9];//药品数量
    public static byte[] goodsByBind = new byte[9];//绑定情况
    public static long[] goodsKey = new long[]{0, 0, 0, 0, 0, 0, 0, 0, 0};//物品slot_id，0 - 2 血药， 3 - 5 蓝药， 6 - 8 经验卡
    public static int skillSetIndex;
    public static Image[] skillIcon = new Image[9];
//    public static String[] skillKey = new String[9];//技能KEY
    public static int[] skillIndex = new int[9];//技能索引
    public static boolean[] hangUpSet = new boolean[7];// 0是否使用还魂丹 1自动喂养宠物 2自动修理 3自动加入队伍 4是否使用血药 5是否使用蓝药 6是否使用经验卡
    //记录物品的冷却时间
    public static long lHangupCoolTIme[][] = {
        {0, 5000},
        {0, 5000},
        {0, 5000},
        {0, 5000},
        {0, 5000},
        {0, 5000}//物品冷却 0 -5
    };

    public static int getCanUseSkillIndex() {
        if (Player.iuseSkillIndex == skillIndex.length) {
            Player.iuseSkillIndex = 0;
        }
        boolean havefind = false;
        for (int i = Player.iuseSkillIndex; i < skillIndex.length; i++) {
            if (skillIndex[i] != 0 && (Player.iPlayerSkillStartTime[skillIndex[i]] == -1))//有技能并且非冷却
            {
                Player.iuseSkillIndex += 1;
                return skillIndex[i];
            } else if (skillIndex[i] == 0) {
                Player.iuseSkillIndex += 1;
            }
        }
//         Player.iuseSkillIndex = 0;
        return 0;
    }

    public static int getGoodsIndex(int index) {
        if (goodsKey == null || (index + 3 > goodsKey.length)) {
            return -1;
        }
        for (int i = index; i < index + 3; i++) {
//            System.out.println("goodsKey[i]" + i + ":" + goodsKey[i]);
            if (goodsKey[i] != 0) {
                return i;
            }
        }
        return -1;
    }

    public static long getGoodsKey(int index) {
        if (goodsKey == null || (index > goodsKey.length)) {
            return -1;
        }
        return goodsKey[index];
    }

    public static void deleteHangUpGoods(long goodskey) {
        for (int i = 0; i < goodsKey.length; i++) {
            if (goodsKey[i] == goodskey) {
                goodsKey[i] = 0;
                break;
            }
        }
    }

    public void initHangUp() {
        //#if NOKIA_S60V5
         imgArray = new Image[9];
         imgArray[0] = ResManager.createImage(90000017);//背景图片
         imgArray[1] = Tools.makeBlueMask();//蓝光图片
         imgArray[2] = Tools.makeTransparent(ResManager.createImage(90000051), 255);//边框图片
         imgArray[3] = Goods.createGoodsBg((byte) 1);
         imgArray[4] = ResManager.createImage(90000084);//方向键
         imgArray[5] = ResManager.createImage(90000085);//确定键
         imgArray[6] = ResManager.createImage(90000043);//字图
         imgArray[7] = ResManager.createImage(90000086);//底部蓝条
         imgArray[8] = ResManager.createImage(90000087);//格子框
         bySelectIndex = 1;
         iPositionY = Constant.UI_START_Y + 41;
        //#else
//#        imgArray = new Image[4];
//#        imgArray[0] = ResManager.createImage(90000017);//背景图片
        //#if NORMAL_240_400
//# //        imgArray[0] = Tools.ZoomImage(imgArray[0], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
        //#endif
//#        imgArray[1] = Tools.makeBlueMask();//蓝光图片
//#        imgArray[2] = Tools.makeTransparent(ResManager.createImage(90000051), 255);//边框图片
//#        imgArray[3] = Goods.createGoodsBg((byte) 1);
//#        bySelectIndex = 1;
//#        iPositionY = Constant.UI_START_Y + 21;
        //#endif

        //#if NOKIA_E72
//#         Tools.initE72ScollBar();
        //#endif
        //测试
//        getHangUpTime(5, (short) 10);//在线挂机测试
//        getTotalExp(10000);//离线挂机测试
    }

    public void getHangUpTime(int time1, short time2) {
        byState = 1;
        sArray = new String[]{"挂机", "1 在线挂机", "2 离线挂机", "挂机时间:",// 0 - 3
            "技能设置", "血≤30%吃红药", "蓝≤30%吃蓝药", "使用经验卡", "使用还魂丹复活",// 4 - 8
            "自动喂养宠物", "自动修理", "自动加入组队", "开始挂机", "返回", "开启", "关闭"// 9 - 15
        };
        //#if NOKIA_S60V5
         sArray[3] = "可用时间:" + time1 + "分";
        //#else
//#        sArray[3] = "可用时间:" + time1 + "分钟,已用时间:" + time2 + "分钟";
        //#endif
        if (GameBean.BL_PLAYER_HANGUP) {
            sArray[12] = "取消挂机";
        } else {
            sArray[12] = "开始挂机";
        }
        hangUpGoods = new Goods((short) 9, Constant.ITEM_COLUMN_TYPE_COMMON);
        if (GameBean.BY_PRE_GAME_UI_STATE == Constant.GAME_UI_SKILL) {
            bySelectIndex = 2;
            bySubSelectIndex = (byte) (skillSetIndex + 1);
            GameBean.BY_PRE_GAME_UI_STATE = -1;
        } else {
            bySubSelectIndex = 1;
        }
    }

    public void getTotalExp(int exp) {
        byState = 2;
        hangUpGoods = new Goods((short) 1, Constant.ITEM_COLUMN_TYPE_COMMON);
        sArray = new String[]{"挂机", "1 在线挂机", "2 离线挂机", "累计挂机经验：",// 0 - 3
            "使用幻蝶仙丹：", "使用增幅道具：", "本次提取经验值：", "提取经验", "返回"// 4 - 8
        };
        iData = new int[3];
        iData[0] = exp;
        iData[1] = 1;
        setExp();
    }

    public void setExp() {
        iData[2] = iData[1] * 9000;
        if (hangUpGoods.sGoodsKey[0] != null) {
            if (hangUpGoods.sGoodsKey[0].equals("90031")) {//黄粱一梦
                iData[2] = iData[2] << 1;
            } else if (hangUpGoods.sGoodsKey[0].equals("90032")) {//南柯一梦
                iData[2] = iData[2] * 3;
            } else if (hangUpGoods.sGoodsKey[0].equals("90033")) {//春宵一梦
                iData[2] = iData[2] * 4;
            }
        }
    }

    private void drawGoodsInfo(Graphics g, int startX, int startY, int columnIndex) {
        //#if NOKIA_S60V5
         startX += 6;
         startY += 6;
        //#endif
        //格子可以用已经放了东西;
        g.drawImage(goodsIcon[columnIndex], startX + ((30 - goodsIcon[columnIndex].getWidth()) >> 1),
                startY + ((30 - goodsIcon[columnIndex].getHeight()) >> 1), 0);
        //绘制物品的品质颜色
        Tools.setColor(g, hangUpGoods.getGoodsNameColor(goodsColor[columnIndex]));
        g.drawRect(startX + 1, startY + 1, 27, 27);
        //左上
        g.drawRect(startX + 1, startY + 1, 1, 2);
        g.drawRect(startX + 1, startY + 1, 2, 1);
        //左下
        g.drawRect(startX + 1, startY + 26, 1, 2);
        g.drawRect(startX + 1, startY + 27, 2, 1);
        //右上
        g.drawRect(startX + 26, startY + 1, 2, 1);
        g.drawRect(startX + 27, startY + 1, 1, 2);
        //右下
        g.drawRect(startX + 27, startY + 26, 1, 2);
        g.drawRect(startX + 26, startY + 27, 2, 1);
        //绘制物品的数量
        if (goodsNum[columnIndex] > 0) {
            hangUpGoods.drawGoodsStackNum(g, String.valueOf(goodsNum[columnIndex]), hangUpGoods.img[2], startX + 30 - hangUpGoods.getGoodsStackNumWidth(String.valueOf(goodsNum[columnIndex])), startY + 30 - 7);
        }
        if (goodsByBind != null && goodsByBind[columnIndex] == 1 && hangUpGoods.img[3] != null) {
            g.drawImage(hangUpGoods.img[3], startX + 15, startY + 6, 0);
        }
    }

    public void drawHangUp(Graphics g) {
        //绘制背景
        startX = Constant.UI_START_X + 0;
        startY = Constant.UI_START_Y + 0;
        if (byState == 1) {//在线挂机
            //#if NOKIA_E72
//#             g.setClip(startX, startY, Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT - 25);
            //#endif
            //#if NOKIA_S60V5
             if (GameBean.BL_PLAYER_HANGUP) {
                 Tools.drawS60V5Frame(g, imgArray[0], imgArray[4], imgArray[5], imgArray[7], imgArray[6], 100, 1, 45, 21,
                         imgArray[6], 52, 182, 94, 23, sArray[0]);
             } else {
                 Tools.drawS60V5Frame(g, imgArray[0], imgArray[4], imgArray[5], imgArray[7], null, sArray[0]);
                 g.drawRegion(imgArray[6], 100, 1, 45, 21, Constant.TRANS_NONE,
                         Constant.UI_START_X + 8, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
                 g.drawRegion(imgArray[6], 247, 157, 47, 23, Constant.TRANS_NONE,
                         Constant.UI_START_X + 258, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
                 g.drawRegion(imgArray[6], 0, 182, 47, 23, Constant.TRANS_NONE,
                         Constant.UI_START_X + 305, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
             }
            //#elif NOKIA_E72
//#             Tools.drawE72Frame(g, imgArray[0], null, sArray[0]);
            //#else
//#            Tools.drawFrame(g, imgArray[0], imgArray[1], sArray[12], sArray[13], sArray[0]);
            //#endif
            //绘制选项卡
            w = Constant.DRAW_WIDTH >> 1;
            startX += (w - Constant.FONT_SMALL.stringWidth(sArray[1]) >> 1);
            //#if NOKIA_S60V5
             h = 41;
             startY += (41 + (h - Constant.FONT_SMALL_HEIGHT >> 1));
            //#elif NOKIA_E72
//#             h = 30;
//#             startY += (21 + (h - Constant.FONT_SMALL_HEIGHT >> 1) + UiInterFace.iScreenOffsetH);
            //#else
//#            h = 30;
//#            startY += (21 + (h - Constant.FONT_SMALL_HEIGHT >> 1));
            //#endif
            Tools.drawShadowString(g, (byte) 1, sArray[1], startX, startY, selectColor, blackColor);//在线挂机
            startX = Constant.UI_START_X + w + (w - Constant.FONT_SMALL.stringWidth(sArray[2]) >> 1);
            Tools.drawShadowString(g, (byte) 1, sArray[2], startX, startY, whiteColor, blackColor);//离线挂机
            //具体设置
            //#if NOKIA_S60V5
             h = (Constant.FONT_SMALL_HEIGHT + 5) * 5 + 161;//1个38技能栏，3个41物品栏
             startY = Constant.UI_START_Y + 82 + (Constant.END_LINE - 82 - h >> 1);//41标题，41选项卡
            //#elif NOKIA_E72
//#             h = Constant.FONT_SMALL_HEIGHT * 6 + 120;
//#             startY = Constant.UI_START_Y + 61 + UiInterFace.iScreenOffsetH;//10为间隔
            //#else
//#            h = Constant.FONT_SMALL_HEIGHT * 6 + 120;
//#            startY = Constant.UI_START_Y + 51 + (Constant.DRAW_HEIGHT - 76 - h >> 1);
            //#endif
            w = Constant.DRAW_WIDTH - 10;
            startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - w >> 1);
            Tools.drawRoundRect(g, imgArray[2], 0x989898, w, h, startX, startY);//设置背景
            //#if NOKIA_S60V5
             w = 37 * 9;
             h = Constant.FONT_SMALL_HEIGHT + 5;
             startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - w >> 1);
             Tools.drawShadowString(g, (byte) 1, sArray[4], startX, startY, whiteColor, blackColor);//技能设置
             startX += (w - Constant.FONT_SMALL.stringWidth(sArray[3]));
             Tools.drawShadowString(g, (byte) 1, sArray[3], startX, startY, whiteColor, blackColor);//剩余时间
             startY += h;
            //#else
//#            h = Constant.FONT_SMALL_HEIGHT;
//#            startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sArray[3]) >> 1);
//#            Tools.drawShadowString(g, (byte) 1, sArray[3], startX, startY, whiteColor, blackColor);//剩余时间
//#            startY += h;
//#            startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sArray[4]) >> 1);
//#            Tools.drawShadowString(g, (byte) 1, sArray[4], startX, startY, whiteColor, blackColor);//技能设置
//#            startY += h;
//#            w = 25 * 9;
            //#endif
            startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - w >> 1);
            for (int i = 0; i < 9; i++) {
                //#if NOKIA_S60V5
                 MainLogic.getInstance().uiInterFace.drawQuickSetRect(g, imgArray[8], null, startX + 37 * i, startY);
                 if (skillIcon[i] != null) {
                     g.drawImage(skillIcon[i], startX + 37 * i + 5, startY + 5, 0);
                 }
                //#else
//#                Tools.drawPackageBox(g, imgArray[3], startX + 25 * i, startY, (byte) 0, 13, 13);
//#                if (skillIcon[i] != null) {
//#                    g.drawImage(skillIcon[i], startX + 25 * i - 2, startY - 2, 0);
//#                }
                //#endif
            }
            //#if NOKIA_S60V5
             h = 41;
            //#else
//#            h = 30;
            //#endif
            startY += h;
            for (int i = 0; i < 3; i++) {
                Tools.drawShadowString(g, (byte) 1, sArray[i + 5], startX, startY + (h - Constant.FONT_SMALL_HEIGHT >> 1) + h * i,
                        bySelectIndex == i + 3 ? selectColor : whiteColor, blackColor);
            }
            for (int i = 0; i < 9; i++) {
                //#if NOKIA_S60V5
                 hangUpGoods.drawGoods(g, startX + Constant.FONT_SMALL.stringWidth(sArray[5]) + 40 * (i % 3),
                         startY + 40 * (i / 3), (short) i);
                 if (goodsKey[i] != 0) {
                     drawGoodsInfo(g, startX + Constant.FONT_SMALL.stringWidth(sArray[5]) + 40 * (i % 3),
                             startY + 40 * (i / 3), (short) i);
                 }
                //#else
//#                hangUpGoods.drawGoods(g, startX + Constant.FONT_SMALL.stringWidth(sArray[5]) + 29 * (i % 3),
//#                        startY + 29 * (i / 3), (short) i);
//#                if (goodsKey[i] != 0) {
//#                    drawGoodsInfo(g, startX + Constant.FONT_SMALL.stringWidth(sArray[5]) + 29 * (i % 3),
//#                            startY + 29 * (i / 3), (short) i);
//#                }
                //#endif
            }
            startY += 3 * h;
            //#if NOKIA_S60V5
             h = Constant.FONT_SMALL_HEIGHT + 5;
            //#else
//#            h = Constant.FONT_SMALL_HEIGHT;
            //#endif
            for (int i = 0; i < 4; i++) {
                Tools.drawShadowString(g, (byte) 1, sArray[i + 8], startX, startY,
                        bySelectIndex == i + 6 ? selectColor : whiteColor, blackColor);
                Tools.drawShadowString(g, (byte) 1, hangUpSet[i] ? sArray[15] : sArray[14],
                        startX + Constant.FONT_SMALL.stringWidth(sArray[5]) + (88 - Constant.FONT_SMALL.stringWidth(sArray[14]) >> 1),
                        startY, bySelectIndex == i + 6 ? selectColor : whiteColor, blackColor);
                startY += h;
            }
            //绘制选择条
            startX = Constant.UI_START_X + 0;
            w = Constant.DRAW_WIDTH;
            if (bySelectIndex == 1) {
                //#if NOKIA_S60V5
                 h = 41;
                //#else
//#                h = 30;
                //#endif
                Tools.drawGapSlectMask(g, imgArray[1], null, false, h, startX, iPositionY, w);
            } else if (bySelectIndex == 2) {//技能设置
                //#if NOKIA_S60V5
                 startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - 37 * 9 >> 1) + 37 * (bySubSelectIndex - 1);
                 h = (Constant.FONT_SMALL_HEIGHT + 5) * 5 + 161;//1个38技能栏，3个41物品栏
                 startY = Constant.UI_START_Y + 82 + (Constant.END_LINE - 82 - h >> 1) + (Constant.FONT_SMALL_HEIGHT + 5);
                 Tools.drawTilePic(g, (byte) 1, startX, startY, 38, imgArray[1], 0, imgArray[1].getHeight() - 19,
                         imgArray[1].getWidth(), 19, Constant.TRANS_ROT180);
                 Tools.drawTilePic(g, (byte) 1, startX, startY + 19, 38, imgArray[1], 0, imgArray[1].getHeight() - 19,
                         imgArray[1].getWidth(), 19, Constant.TRANS_NONE);
                //#else
//#                startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - 25 * 9 >> 1) + 25 * (bySubSelectIndex - 1);
//#                h = Constant.FONT_SMALL_HEIGHT * 6 + 120;
                //#if NOKIA_E72
//#                 startY = Constant.UI_START_Y + 61 + (Constant.FONT_SMALL_HEIGHT << 1) + UiInterFace.iScreenOffsetH;
                //#else
//#                startY = Constant.UI_START_Y + 51 + (Constant.DRAW_HEIGHT - 76 - h >> 1)
//#                        + (Constant.FONT_SMALL_HEIGHT << 1);
                //#endif
//#                Tools.drawTilePic(g, (byte) 1, startX, startY, 26, imgArray[1], 0, imgArray[1].getHeight() - 13,
//#                        imgArray[1].getWidth(), 13, Constant.TRANS_ROT180);
//#                Tools.drawTilePic(g, (byte) 1, startX, startY + 13, 26, imgArray[1], 0, imgArray[1].getHeight() - 13,
//#                        imgArray[1].getWidth(), 13, Constant.TRANS_NONE);
                //#endif
            } else if (bySelectIndex < 6) {//物品设置
                //#if NOKIA_S60V5
                 startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - 37 * 9 >> 1)
                         + Constant.FONT_SMALL.stringWidth(sArray[5]) + (bySubSelectIndex - 1) * 40;
                 h = (Constant.FONT_SMALL_HEIGHT + 5) * 5 + 161;//1个38技能栏，3个41物品栏
                 startY = Constant.UI_START_Y + 82 + (Constant.END_LINE - 82 - h >> 1)
                         + (Constant.FONT_SMALL_HEIGHT + 5) + 41 + 40 * (bySelectIndex - 3);
                //#else
//#                startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - 25 * 9 >> 1)
//#                        + Constant.FONT_SMALL.stringWidth(sArray[5]) + (bySubSelectIndex - 1) * 29;
//#                h = Constant.FONT_SMALL_HEIGHT * 6 + 120;
                //#if NOKIA_E72
//#                 startY = Constant.UI_START_Y + 61 + (Constant.FONT_SMALL_HEIGHT << 1) + 30
//#                         + 29 * (bySelectIndex - 3) + UiInterFace.iScreenOffsetH;
                //#else
//#                startY = Constant.UI_START_Y + 51 + (Constant.DRAW_HEIGHT - 76 - h >> 1)
//#                        + (Constant.FONT_SMALL_HEIGHT << 1) + 30 + 29 * (bySelectIndex - 3);
                //#endif
                //#endif
                hangUpGoods.drawSelectStyle(g, startX, startY);
            } else {
                Tools.drawSelectMask(g, (byte) 1, imgArray[1], startX, iPositionY, w);
            }
            //#if NOKIA_E72
//#             g.setClip(0, 0, Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
//#             g.drawRegion(imgArray[0], 0, Constant.DRAW_HEIGHT - 25, imgArray[0].getWidth(), 25,
//#                     Constant.TRANS_NONE, 0, Constant.DRAW_HEIGHT - 25, 0);
//#             Tools.drawSelectMask(g, (byte) 2, imgArray[1], Constant.UI_START_X, 
//#                     Constant.UI_START_Y + Constant.DRAW_HEIGHT - 25, Constant.DRAW_WIDTH);
//#             Tools.drawShadowString(g, (byte) 1, sArray[12], Constant.UI_START_X + 8,
//#                     Constant.UI_START_Y + Constant.DRAW_HEIGHT - 25 + (25 - Constant.FONT_SMALL_HEIGHT >> 1),
//#                     selectColor, blackColor);
//#             Tools.drawShadowString(g, (byte) 1, sArray[13], Constant.UI_START_X + Constant.DRAW_WIDTH - 8 - Constant.FONT_SMALL.stringWidth(sArray[13]),
//#                     Constant.UI_START_Y + Constant.DRAW_HEIGHT - 25 + (25 - Constant.FONT_SMALL_HEIGHT >> 1),
//#                     selectColor, blackColor);
//#             Tools.drawE72ScrollBar(g);
            //#endif
            
            MainView.drawTouchRect(g, mHangUpTouchRect);
            
        } else if (byState == 2) {//离线挂机
            //#if NOKIA_S60V5
             Tools.drawS60V5Frame(g, imgArray[0], imgArray[4], imgArray[5], imgArray[7], null, sArray[0]);
             g.drawRegion(imgArray[6], 100, 1, 45, 21, Constant.TRANS_NONE,
                     Constant.UI_START_X + 8, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
             g.drawRegion(imgArray[6], 148, 158, 95, 22, Constant.TRANS_NONE,
                     Constant.UI_START_X + Constant.DRAW_WIDTH - 8 - 95, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
            //#else
//#            Tools.drawFrame(g, imgArray[0], imgArray[1], sArray[7], sArray[8], sArray[0]);
            //#endif
            //绘制选项卡
            w = Constant.DRAW_WIDTH >> 1;
            startX += (w - Constant.FONT_SMALL.stringWidth(sArray[1]) >> 1);
            //#if NOKIA_S60V5
             h = 41;
             startY += (h + (h - Constant.FONT_SMALL_HEIGHT >> 1));
            //#else
//#            h = 30;
//#            startY += (21 + (h - Constant.FONT_SMALL_HEIGHT >> 1));
            //#endif
            Tools.drawShadowString(g, (byte) 1, sArray[1], startX, startY, whiteColor, blackColor);//在线挂机
            startX = Constant.UI_START_X + w + (w - Constant.FONT_SMALL.stringWidth(sArray[2]) >> 1);
            Tools.drawShadowString(g, (byte) 1, sArray[2], startX, startY, selectColor, blackColor);//离线挂机
            //累计经验
            //#if NOKIA_S60V5
             startY = Constant.UI_START_Y + (h << 1) + 20;
            //#else
//#            startY = Constant.UI_START_Y + 71;//21标题，30选项卡, 20间隔
//#            h = 30;
            //#endif
            w = Constant.DRAW_WIDTH - 10;
            startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - w >> 1);
            Tools.drawRoundRect(g, imgArray[2], 0x989898, w, h, startX, startY);//累计经验背景
            startX += (w - Constant.FONT_SMALL.stringWidth(sArray[3] + iData[0]) >> 1);
            startY += (h - Constant.FONT_SMALL_HEIGHT >> 1);
            Tools.drawShadowString(g, (byte) 1, sArray[3] + iData[0], startX, startY, whiteColor, blackColor);//累计经验
            //道具选择
            //#if NOKIA_S60V5
             startY = Constant.UI_START_Y + 122 + h;
            //#else
//#            startY = Constant.UI_START_Y + 91 + h;//21标题，30选项卡，h累计经验，20间隔1，20间隔2
            //#endif
            startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - w >> 1);
            Tools.drawRoundRect(g, imgArray[2], 0x989898, w, h * 3, startX, startY);//道具选择背景
            hangUpGoods.drawGoods(g, startX + 10 + Constant.FONT_SMALL.stringWidth(sArray[5]), startY + h, (short) 0);//道具
            startX += 10;
            startY += (h - Constant.FONT_SMALL_HEIGHT >> 1);
            Tools.drawShadowString(g, (byte) 1, sArray[4] + iData[1], startX, startY,
                    bySelectIndex == 2 ? selectColor : whiteColor, blackColor);//幻蝶仙丹
            startY += h;
            Tools.drawShadowString(g, (byte) 1, sArray[5], startX, startY,
                    bySelectIndex == 3 ? selectColor : whiteColor, blackColor);//增幅道具
            startY += h;
            Tools.drawShadowString(g, (byte) 1, sArray[6] + iData[2], startX, startY,
                    bySelectIndex == 4 ? selectColor : whiteColor, blackColor);//本次提取经验值
            //绘制选择条
            startX = Constant.UI_START_X + 0;
            if (bySelectIndex == 1) {
                w = Constant.DRAW_WIDTH;
                //#if NOKIA_S60V5
                 h = 41;
                //#else
//#                h = 30;
                //#endif
                Tools.drawGapSlectMask(g, imgArray[1], null, false, h, startX, iPositionY, w);
            } else if (bySelectIndex == 2) {
                w = Constant.DRAW_WIDTH;
                Tools.drawSelectMask(g, (byte) 1, imgArray[1], startX, iPositionY, w);
            } else if (bySelectIndex == 3) {
                //#if NOKIA_S60V5
                 startY = Constant.UI_START_Y + 204;//41标题，41选项卡，41累计经验，20间隔1，20间隔2，41幻蝶仙丹
                //#else
//#                startY = Constant.UI_START_Y + 151;//21标题，30选项卡，30累计经验，20间隔1，20间隔2，30幻蝶仙丹
                //#endif
                w = Constant.DRAW_WIDTH - 10;
                startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - w >> 1)
                        + 10 + Constant.FONT_SMALL.stringWidth(sArray[5]);
                hangUpGoods.drawSelectStyle(g, startX, startY);
            }
        }
    }

    public void updateHangUp() {
        if (GameBean.b_WAIT_NET_MSG_BACK) {
            return;
        }
        if (!bUiKeyPressLock) {
            if (byState == 1) {//在线挂机
                if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                    bUiKeyPressLock = true;
                    if (bySelectIndex == 2 || bySelectIndex == 3) {
                        bySubSelectIndex = 1;
                    }
                    bySelectIndex = (byte) (bySelectIndex == 1 ? 9 : (bySelectIndex - 1));
                    //#if NOKIA_E72
//#                     Tools.updateE72ScollBar(((bySelectIndex - 1) * (-27)));
                    //#endif
                    if (bySelectIndex == 1) {
                        //#if NOKIA_S60V5
                         startY = Constant.UI_START_Y + 41;
                        //#elif NOKIA_E72
//#                         startY = Constant.UI_START_Y + 21 + UiInterFace.iScreenOffsetH;
                        //#else
//#                        startY = Constant.UI_START_Y + 21;
                        //#endif
                    } else if (bySelectIndex > 5) {
                        //#if NOKIA_S60V5
                         h = (Constant.FONT_SMALL_HEIGHT + 5) * 5 + 161;//1个38技能栏，3个41物品栏
                         startY = Constant.UI_START_Y + 82 + (Constant.END_LINE - 82 - h >> 1)
                                 + 161 + (Constant.FONT_SMALL_HEIGHT + 5) * (bySelectIndex - 4);
                        //#else
//#                        h = Constant.FONT_SMALL_HEIGHT * 6 + 120;
                        //#if NOKIA_E72
//#                         startY = Constant.UI_START_Y + 61 + 120 + Constant.FONT_SMALL_HEIGHT * (bySelectIndex - 3)
//#                                 + UiInterFace.iScreenOffsetH;
                        //#else
//#                        startY = Constant.UI_START_Y + 51 + (Constant.DRAW_HEIGHT - 76 - h >> 1)
//#                                + 120 + Constant.FONT_SMALL_HEIGHT * (bySelectIndex - 3);
                        //#endif
                        //#endif
                    }
                    iArray = new int[]{2, 1, startY, 2, 50, 5};
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                    bUiKeyPressLock = true;
                    if (bySelectIndex == 2) {
                        bySubSelectIndex = 1;
                    }
                    bySelectIndex = (byte) (bySelectIndex == 9 ? 1 : (bySelectIndex + 1));
                    //#if NOKIA_E72
//#                     Tools.updateE72ScollBar(((bySelectIndex - 1) * (-27)));
                    //#endif
                    if (bySelectIndex == 1) {
                        //#if NOKIA_S60V5
                         startY = Constant.UI_START_Y + 41;
                        //#elif NOKIA_E72
//#                         startY = Constant.UI_START_Y + 21 + UiInterFace.iScreenOffsetH;
                        //#else
//#                        startY = Constant.UI_START_Y + 21;
                        //#endif
                    } else if (bySelectIndex > 5) {
                        //#if NOKIA_S60V5
                         h = (Constant.FONT_SMALL_HEIGHT + 5) * 5 + 161;//1个38技能栏，3个41物品栏
                         startY = Constant.UI_START_Y + 82 + (Constant.END_LINE - 82 - h >> 1)
                                 + 161 + (Constant.FONT_SMALL_HEIGHT + 5) * (bySelectIndex - 4);
                        //#else
//#                        h = Constant.FONT_SMALL_HEIGHT * 6 + 120;
                        //#if NOKIA_E72
//#                         startY = Constant.UI_START_Y + 61 + 120 + Constant.FONT_SMALL_HEIGHT * (bySelectIndex - 3)
//#                                 + UiInterFace.iScreenOffsetH;
                        //#else
//#                        startY = Constant.UI_START_Y + 51 + (Constant.DRAW_HEIGHT - 76 - h >> 1)
//#                                + 120 + Constant.FONT_SMALL_HEIGHT * (bySelectIndex - 3);
                        //#endif
                        //#endif
                    }
                    iArray = new int[]{1, 1, startY, 2, 50, 5};
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_LEFT, false)) {
                    bUiKeyPressLock = true;
                    if (bySelectIndex == 1) {//跳到离线挂机
                        MainLogic.getInstance().send(Constant.MSG_NET_CMD_OFFLINEHANG_OPEN, Constant.SOCKET_MSG_TYPE_LOGIC);
                        GameBean.b_WAIT_NET_MSG_BACK = true;
                    } else if (bySelectIndex == 2) {//技能设置
                        bySubSelectIndex = (byte) (bySubSelectIndex == 1 ? 9 : (bySubSelectIndex - 1));
                    } else if (bySelectIndex < 6) {//物品设置
                        bySubSelectIndex = (byte) (bySubSelectIndex == 1 ? 3 : (bySubSelectIndex - 1));
                    }
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_RIGHT, false)) {
                    bUiKeyPressLock = true;
                    if (bySelectIndex == 1) {//跳到离线挂机
                        MainLogic.getInstance().send(Constant.MSG_NET_CMD_OFFLINEHANG_OPEN, Constant.SOCKET_MSG_TYPE_LOGIC);
                        GameBean.b_WAIT_NET_MSG_BACK = true;
                    } else if (bySelectIndex == 2) {//技能设置
                        bySubSelectIndex = (byte) (bySubSelectIndex == 9 ? 1 : (bySubSelectIndex + 1));
                    } else if (bySelectIndex < 6) {//物品设置
                        bySubSelectIndex = (byte) (bySubSelectIndex == 3 ? 1 : (bySubSelectIndex + 1));
                    }
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                        || (MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false))) {
                    bUiKeyPressLock = true;
                    if (bySelectIndex == 1) {
                        return;
                    } else if (bySelectIndex == 2) {//设置技能
                        skillSetIndex = bySubSelectIndex - 1;
                        GameBean.BY_PRE_GAME_UI_STATE = Constant.GAME_UI_HANGUP;
                        MainLogic.getInstance().send(Constant.MSG_NET_OPEN_KUNGFU, Constant.SOCKET_MSG_TYPE_LOGIC);
                    } else if (bySelectIndex > 2 && bySelectIndex < 6) {//设置物品
                        MainLogic.getInstance().uiPackage.showBag(Constant.ITEM_COLUMN_TYPE_COMMON);
                    } else {
                        hangUpSet[bySelectIndex - 6] = !hangUpSet[bySelectIndex - 6];
                    }
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)) {//开启、取消挂机
                    bUiKeyPressLock = true;
                    if (MainLogic.getInstance().gamePlayer.iPlayerLevel < 15) {
                        MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "15级以上的玩家方可开启在线挂机!", (byte) 1, (byte) -1);
                    } else {
                        if (goodsKey[0] > 0 || goodsKey[1] > 0 || goodsKey[2] > 0) {
                            hangUpSet[4] = true;
                        } else {
                            hangUpSet[4] = false;
                        }
                        if (goodsKey[3] > 0 || goodsKey[4] > 0 || goodsKey[5] > 0) {
                            hangUpSet[5] = true;
                        } else {
                            hangUpSet[5] = false;
                        }
                        if (goodsKey[6] > 0 || goodsKey[7] > 0 || goodsKey[8] > 0) {
                            hangUpSet[6] = true;
                        } else {
                            hangUpSet[6] = false;
                        }
                        MainLogic.getInstance().clearLockedObj(0, true);
                        MainLogic.getInstance().send(Constant.MSG_NET_CMD_ONLINEHANG, Constant.SOCKET_MSG_TYPE_LOGIC);
                        GameBean.b_WAIT_NET_MSG_BACK = true;
                    }
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//返回
                    bUiKeyPressLock = true;
                    //#if NOKIA_S60V5
                     Tools.openRoamMenu(false, (byte) 1, (byte) 0, 14);
                    //#else
//#                    Tools.openRoamMenu(false, (byte) 2, (byte) 0, 4);
                    //#endif
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_2, false)) {//跳到离线挂机
                    MainLogic.getInstance().send(Constant.MSG_NET_CMD_OFFLINEHANG_OPEN, Constant.SOCKET_MSG_TYPE_LOGIC);
                    GameBean.b_WAIT_NET_MSG_BACK = true;
                }
            } else if (byState == 2) {//离线挂机
                if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                    bUiKeyPressLock = true;
                    bySelectIndex = (byte) (bySelectIndex == 1 ? 3 : (bySelectIndex - 1));
                    if (bySelectIndex == 1) {
                        //#if NOKIA_S60V5
                         startY = Constant.UI_START_Y + 41;
                        //#else
//#                        startY = Constant.UI_START_Y + 21;
                        //#endif
                    } else if (bySelectIndex == 2) {
                        //#if NOKIA_S60V5
                         startY = Constant.UI_START_Y + 204;//41标题，41选项卡，41累计经验，20间隔1，20间隔2，41幻蝶仙丹
                        //#else
//#                        startY = Constant.UI_START_Y + 151;//21标题，30选项卡，30累计经验，20间隔1，20间隔2，30幻蝶仙丹
                        //#endif
                    }
                    iArray = new int[]{2, 1, startY, 2, 50, 5};
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                    bUiKeyPressLock = true;
                    bySelectIndex = (byte) (bySelectIndex == 3 ? 1 : (bySelectIndex + 1));
                    if (bySelectIndex == 1) {
                        //#if NOKIA_S60V5
                         startY = Constant.UI_START_Y + 41;
                        //#else
//#                        startY = Constant.UI_START_Y + 21;
                        //#endif
                    } else if (bySelectIndex == 2) {
                        //#if NOKIA_S60V5
                         startY = Constant.UI_START_Y + 204;//41标题，41选项卡，41累计经验，20间隔1，20间隔2，41幻蝶仙丹
                        //#else
//#                        startY = Constant.UI_START_Y + 151;//21标题，30选项卡，30累计经验，20间隔1，20间隔2，30幻蝶仙丹
                        //#endif
                    }
                    iArray = new int[]{1, 1, startY, 2, 50, 5};
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_LEFT, false)
                        || MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)
                        || MainCanvas.keyPressedLogic(Constant.GAME_KEY_1, false)) {//跳到在线挂机
                    bUiKeyPressLock = true;
                    MainLogic.getInstance().send(Constant.MSG_NET_CMD_ONLINEHANG_UI, Constant.SOCKET_MSG_TYPE_LOGIC);
                    GameBean.b_WAIT_NET_MSG_BACK = true;
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                        || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {
                    bUiKeyPressLock = true;
                    if (bySelectIndex == 2) {//幻蝶仙丹
                        MainLogic.inputInterFace.setInputInterFace(byState, "请输入幻蝶仙丹数量：");
                        MainGame.changeCanvas(MainLogic.inputInterFace);
                    } else if (bySelectIndex == 3) {//添加道具
                        MainLogic.getInstance().uiPackage.showBag(Constant.ITEM_COLUMN_TYPE_COMMON);
                    }
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)) {//提取经验
                    bUiKeyPressLock = true;
                    if (iData[2] <= 0) {
                        MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "提取经验值须大于0！", (byte) 1, (byte) -1);
                    } else if (iData[2] > iData[0]) {
                        MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "提取经验不得超过累计经验！", (byte) 1, (byte) -1);
                    } else {
                        MainLogic.getInstance().send(Constant.MSG_NET_CMD_OFFLINEHANG_EXTRACT, Constant.SOCKET_MSG_TYPE_LOGIC);
                        GameBean.b_WAIT_NET_MSG_BACK = true;
                    }
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//返回
                    bUiKeyPressLock = true;
                    //#if NOKIA_S60V5
                     Tools.openRoamMenu(false, (byte) 1, (byte) 0, 14);
                    //#else
//#                    Tools.openRoamMenu(false, (byte) 2, (byte) 0, 4);
                    //#endif
                }
            }
        } else {
            iPositionY = Tools.updateLinePos(iArray, iPositionY);
            if (iArray == null || iArray[1] == 0) {
                bUiKeyPressLock = false;
            }
        }
    }

    public void clearHangUp() {
        imgArray = null;
        sArray = null;
        hangUpGoods = null;
        iData = null;
    }
    
    
    public static int[][] mHangUpTouchRect;
    public static final int BOX_SIZE_1 = 35;
    public static final int BOX_SIZE_2 = 40;
    public void checkTouchHangUp(int x, int y)
    {
    	switch(UiInterFace.property.byState) {
		case 1://在线挂机
			if(mHangUpTouchRect == null)
			{		
				mHangUpTouchRect = new int[][]{
						//在线/离线 选择 index = 1
						{180,40,180,40},
						//技能设置 index = 2
						{15,135,BOX_SIZE_1,BOX_SIZE_1},
						{15+BOX_SIZE_1 + 2,135,BOX_SIZE_1,BOX_SIZE_1},
						{15+(BOX_SIZE_1 + 2)*2,135,BOX_SIZE_1,BOX_SIZE_1},
						{15+(BOX_SIZE_1 + 2)*3,135,BOX_SIZE_1,BOX_SIZE_1},
						{15+(BOX_SIZE_1 + 2)*4,135,BOX_SIZE_1,BOX_SIZE_1},
						{15+(BOX_SIZE_1 + 2)*5,135,BOX_SIZE_1,BOX_SIZE_1},
						{15+(BOX_SIZE_1 + 2)*6,135,BOX_SIZE_1,BOX_SIZE_1},
						{15+(BOX_SIZE_1 + 2)*7,135,BOX_SIZE_1,BOX_SIZE_1},
						{15+(BOX_SIZE_1 + 2)*8,135,BOX_SIZE_1,BOX_SIZE_1},
						//血 index = 3
						{90,175,BOX_SIZE_2,BOX_SIZE_2},{90 + BOX_SIZE_2,175,BOX_SIZE_2,BOX_SIZE_2},{90 + BOX_SIZE_2 * 2,175,BOX_SIZE_2,BOX_SIZE_2},
						//蓝 index = 4
						{90,215,BOX_SIZE_2,BOX_SIZE_2},{90 + BOX_SIZE_2,215,BOX_SIZE_2,BOX_SIZE_2},{90 + BOX_SIZE_2 * 2,215,BOX_SIZE_2,BOX_SIZE_2},
						//经验卡 index = 5
						{90,255,BOX_SIZE_2,BOX_SIZE_2},{90 + BOX_SIZE_2,255,BOX_SIZE_2,BOX_SIZE_2},{90 + BOX_SIZE_2 * 2,255,BOX_SIZE_2,BOX_SIZE_2},
						//使用还魂丹 index = 6
						{0,300,360,20},
						//喂宠物 index = 7
						{0,320,360,20},
						//修理 index = 8
						{0,340,360,20},
						//加入组队 index = 9
						{0,360,360,20},	
				};
			}
			
			int touched = MainCanvas.checkTouch(x, y, mHangUpTouchRect);
			if(touched >= 0)
			{
				if(touched == 0)
				{
					bySelectIndex = 1;
					bySubSelectIndex = 1;
					MainCanvas.pressDir(3);
				
				}
				else if(touched > 0 && touched <= 9)
				{
					bySelectIndex = 2;
					bySubSelectIndex = (byte) (touched - 0);
				}
				else if(touched > 9 && touched <= 12)
				{
					bySelectIndex = 3;
					bySubSelectIndex = (byte) (touched - 9);
				}
				else if(touched > 12 && touched <= 15)
				{
					bySelectIndex = 4;
					bySubSelectIndex = (byte) (touched - 12);
				}
				else if(touched > 15 && touched <= 18)
				{
					bySelectIndex = 5;
					bySubSelectIndex = (byte) (touched - 15);
				}
				else if(touched == 19)
				{
					bySelectIndex = 6;
					bySubSelectIndex = 1;
				}
				else if(touched == 20)
				{
					bySelectIndex = 7;
					bySubSelectIndex = 1;
				}
				else if(touched == 21)
				{
					bySelectIndex = 8;
					bySubSelectIndex = 1;
				}
				else if(touched == 22)
				{
					bySelectIndex = 9;
					bySubSelectIndex = 1;
				}
				
//				 bUiKeyPressLock = true;
                 if (bySelectIndex == 1) 
                     return;
                 else if (bySelectIndex == 2) {//设置技能
                     skillSetIndex = bySubSelectIndex - 1;
                     GameBean.BY_PRE_GAME_UI_STATE = Constant.GAME_UI_HANGUP;
                     MainLogic.getInstance().send(Constant.MSG_NET_OPEN_KUNGFU, Constant.SOCKET_MSG_TYPE_LOGIC);
                 } else if (bySelectIndex > 2 && bySelectIndex < 6) {//设置物品
                     MainLogic.getInstance().uiPackage.showBag(Constant.ITEM_COLUMN_TYPE_COMMON);
                 } else {
                     hangUpSet[bySelectIndex - 6] = !hangUpSet[bySelectIndex - 6];
                 }
				
				
			}
			else
			{
				MainCanvas.checkSoftKey();
        	}
			break;
		case 2://离线挂机
			break;
		}
    }
    
    ///
    public static int[][] mPlayTopTouchRect;
    public static int mPlayTopTouchStartY = 144;
    public static int mLastStartY;
    public static int[][] mPlayTopTouchPopMenuRect = new int[][]{
    	{0,170,360,35},
    	{0,205,360,35},
    };
    public static int[][] mPlayTopTouchPageRect = new int[][]{
    	{130,590,50,50},
    	{183,590,50,50},
    };
    public static int[][] mPlayTopTouchItemRect;
    public void setPlayTopTouchItemRect()
    {
    	
    	int itemCount = this.tempData[2];
    	if(itemCount <= 0)
    		return;
    	int curPageItemCount = 0;
    	if(this.shCurrentPage * byNumPerPage - itemCount > 0)
    	{
    		curPageItemCount =  itemCount - (this.shCurrentPage - 1) * byNumPerPage;
    	}
    	else
    	{
    		curPageItemCount = byNumPerPage;
    	}
    	mPlayTopTouchItemRect = new int[curPageItemCount][];
    	for(int i = 0; i < curPageItemCount; i++)
    	{
    		mPlayTopTouchItemRect[i] = new int[]{
    				0,90 +20* i,360,20
    		};
    	}
    	
    }
    public void setPlayTopTouchStartY(int y)
    {
    	mPlayTopTouchStartY = y;
    	mPlayTopTouchRect = new int[][]{
				{0,mPlayTopTouchStartY,360,20},
				{0,mPlayTopTouchStartY + 21,360,20},
				{0,mPlayTopTouchStartY + 21 * 2,360,20},
				{0,mPlayTopTouchStartY + 21 * 3,360,20},
				{0,mPlayTopTouchStartY + 21 * 4,360,20},
				{0,mPlayTopTouchStartY + 21 * 5,360,20},
		};
    }
    public void checkTouchPlayerTop(int x, int y)
    {
    	 switch (this.byState) {
    	 case 0:
    		 
    		 int touched = MainCanvas.checkTouch(x, y, mPlayTopTouchRect);
    		 if(touched >= 0)
    		 {
    			 int index = touched + 1;
    			 if(index == bySelectIndex)
    			 {
    				 mLastStartY = mPlayTopTouchStartY;
    				 setPlayTopTouchStartY(90);
    				 MainCanvas.pressFire();
    				
    				 
    			 }
    			 else
    				 MainCanvas.pressNum(touched + 1);
    			
    		 }
    		 else
 			 {
 				MainCanvas.checkSoftKey();
         	 }
    		 break;
    	 case 1:
    		 touched = MainCanvas.checkTouch(x, y, mPlayTopTouchPageRect);
    		 if(touched >= 0)
    		 {
    			 int itemCount = this.tempData[2];
    			
    			 if(touched == 0)
    			 {
    				 if(this.shCurrentPage-1 > 0)
        			 {
        				 
    					 MainCanvas.pressDir(2);
        			 }
    			 }
    			 else
    			 {
    				 if(this.shCurrentPage-1 < itemCount/byNumPerPage)
    				 {
    					 MainCanvas.pressDir(3);
    				 }
    			 }
//    			
    		 }
    		 else
    		 {
    			 touched = -1;
    			 if(mPlayTopTouchItemRect != null)
    				 touched = MainCanvas.checkTouch(x, y, mPlayTopTouchItemRect);
    			 if(touched >= 0)
    			 {
    				 bySelectIndex = (byte) (touched+1);
    				 MainCanvas.pressFire();
    			 }
    			 else
    			 {
	    			 setPlayTopTouchStartY(mLastStartY);
	 				 MainCanvas.checkSoftKey();
    			 }
    		 }
    		
    	
    		 break;
    	 case 2:
    		 touched = MainCanvas.checkTouch(x, y, mPlayTopTouchPopMenuRect);
    		 if(touched >= 0)
    		 {
    			 bySelectIndex = (byte) (touched+1);
    			 bySubSelectIndex = bySelectIndex;
    			 MainCanvas.pressFire();
    		 }
    		 else
    		 {
    			 MainCanvas.checkSoftKey();
    		 }
    		 break;
    	 }
    }
    
}
